lib/Stub/AppEvents.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 39
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 39
rs 10
wmc 4
mnd 0
bc 4
fnc 4
bpm 1
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A AppEvents.js ➔ factory 0 18 1
1
var AppEvents = {}
2
3
function factory (name, defaults) {
4
  defaults = defaults || {}
5
  var fullName = 'Application.' + name
6
  var event = function (data) {
7
    var self = this
8
    data = data || {}
9
    Object.defineProperty(this, 'name', {value: fullName, writable: false})
10
    Object.keys(defaults).forEach(function (key) {
11
      self[key] = defaults[key]
12
    })
13
    Object.keys(data).forEach(function (key) {
14
      self[key] = data[key]
15
    })
16
  }
17
  Object.defineProperty(event, 'name', {value: fullName, writable: false})
18
  event._properties = Object.keys(defaults)
19
  AppEvents[name] = event
20
}
21
22
factory('CallAlerting', {
23
  call: {},
24
  callerid: null,
25
  customData: '',
26
  destination: '',
27
  displayName: '',
28
  fromURI: '',
29
  headers: {},
30
  toURI: ''
31
})
32
factory('HttpRequest', {content: '', method: 'POST', path: '/'})
33
factory('Started', {accessURL: ''})
34
factory('Terminating')
35
factory('Terminated')
36
37
module.exports = {
38
  AppEvents: AppEvents
39
}
40