-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmediator.js
More file actions
43 lines (29 loc) · 1007 Bytes
/
mediator.js
File metadata and controls
43 lines (29 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var addClientWizard = addClientWizard || {};
addClientWizard.mediator = {
init: function(){
var self = this;
this._getClientInfoAsync()
.then(this._specifyAddressForClientAsync)
.then(this._saveClient);
},
_getClientInfoAsync: function(){
return new Promise(function(resolve, reject) {
var clientInfoView = new addClientWizard.clientInfoView({model: new addClientWizard.ClientModel()});
$("#wizard").html(clientInfoView.render().el);
clientInfoView.on('done', resolve);
});
},
_specifyAddressForClientAsync: function(client){
return new Promise(function(resolve, reject) {
var addressInfoView = new addClientWizard.addressInfoView({
model: client
});
$("#wizard").html(addressInfoView.render().el);
addressInfoView.on('done', resolve);
});
},
_saveClient: function(client) {
console.log(client);
$("#wizard").html('<div class="notification notification-success">Success!</div>')
}
};