services = tmp;
}
}
- tizen.account.addAccountListener(listener);
+ tizen.__account.addAccountListener(listener);
socket.onmessage = function(msg) {
var ev = JSON.parse(msg.data);
if (ev.type == "ModemAdded") {
- tizen.account.addAccount(new tizen.Account(ev.ModemAdded, ev));
+ tizen.__account.addAccount(new tizen.Account(ev.ModemAdded, ev));
} else if (ev.type == "ModemRemoved") {
- tizen.account.deleteAccount(ev.ModemRemoved);
+ tizen.__account.deleteAccount(ev.id);
} else if (ev.type == "CallAdded") {
calls.push(new __call(this, socket, ev));
} else if (ev.type == "CallRemoved") {
return application;
});
- var call = null;
- this.__defineGetter__("call", function() {
- if (call == null)
- call = new __callmanager();
- return call;
- });
-
this.Account = function (accountId, accountProperties) {
var id = accountId;
var properties = accountProperties;
});
}
}
+
+ var call = null;
+ this.__defineGetter__("call", function() {
+ if (call == null) {
+ // ensure the account object is created first
+ tizen.account;
+
+ call = new __callmanager();
+ }
+ return call;
+ });
var account = null;
this.__defineGetter__("account", function() {
if (account == null)
account = new __accountmanager();
+
+ // ensure the call object is always the first listener
+ // for new accounts, which means we need a backdoor to
+ // access the acount object before the getter has finished
+ // executing for the first time
+ this.__defineGetter__("__account", function() {
+ return account;
+ });
+ if (call == null)
+ call = new __callmanager();
return account;
});
}
var tizen = new __tizen();
-