I have a couple questions about the below code:
What kind of function is this that has brackets on left side but no name before function ? Is this a special kind of function ?
Basically this function accepts callback as listeners, is it defined and run together ?
_
(function(handlers) {
Object.keys(handlers).forEach(function(observableName) {
var observable = app.ko.observable().extend({
notify: 'always'
});
that[observableName] = observable;
var f = handlers[observableName];
if (f) {
observable.subscribe(f);
}
});
})({
onCallIgnored: defaultCallHandler,
onCallStateChanged: function(call) {
that.videoState(call.getRemoteVideoState());
},
onPlacingCall: function(call) {
callParams = app.utils.cloneObj(call);
},
onIncomingCall: function(call) {
that.activeCall = call;
callParams = app.utils.cloneObj(call);
setCallEstablishingTimeout();
app.playSound("ringtone");
that.callProgressTime("");
},
onUpdateCallInfo: function(call) {
console.log(call);
}
});