-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication.js
42 lines (34 loc) · 1.05 KB
/
application.js
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
define(['render',
'events',
'class'],
function(render, Emitter, clazz) {
function Application() {
Application.super_.call(this);
this.render = render;
this.controller = undefined;
}
clazz.inherits(Application, Emitter);
Application.prototype.run = function() {
this.willLaunch();
this.launch();
this.didLaunch();
var self = this;
render.$(document).ready(function() {
self.willDisplay();
self.display();
self.didDisplay();
});
};
Application.prototype.launch = function() {};
Application.prototype.display = function() {
if (!this.controller) throw new Error('No controller initialized by application.');
this.controller.willAddEl();
this.controller.el.prependTo(document.body);
this.controller.didAddEl();
};
Application.prototype.willLaunch = function() {};
Application.prototype.didLaunch = function() {};
Application.prototype.willDisplay = function() {};
Application.prototype.didDisplay = function() {};
return Application;
});