Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50655 views
1
2
/*
3
* browser.js: Browser specific functionality for broadway.
4
*
5
* (C) 2011, Nodejitsu Inc.
6
* MIT LICENSE
7
*
8
*/
9
10
var id = 0;
11
12
var common = {
13
mixin: function (target) {
14
var objs = Array.prototype.slice.call(arguments, 1);
15
objs.forEach(function (o) {
16
Object.keys(o).forEach(function (attr) {
17
var getter = o.__lookupGetter__(attr);
18
if (!getter) {
19
target[attr] = o[attr];
20
}
21
else {
22
target.__defineGetter__(attr, getter);
23
}
24
});
25
});
26
27
return target;
28
},
29
uuid: function () {
30
return String(id++);
31
}
32
};
33
34
var App = exports.App = function (options) {
35
//
36
// Setup options and `App` constants.
37
//
38
var self = this;
39
options = options || {};
40
this.root = options.root;
41
this.delimiter = options.delimiter || '::';
42
43
//
44
// Inherit from `EventEmitter2`
45
//
46
exports.EventEmitter2.call(this, {
47
delimiter: this.delimiter,
48
wildcard: true
49
});
50
51
//
52
// Setup other relevant options such as the plugins
53
// for this instance.
54
//
55
this.options = options;
56
this.plugins = options.plugins || {};
57
this.initialized = false;
58
this.bootstrapper = { init: function (app, func) {} };
59
this.initializers = {};
60
};
61
62
var inherit = function (ctor, superCtor) {
63
ctor.super_ = superCtor;
64
ctor.prototype = Object.create(superCtor.prototype, {
65
constructor: {
66
value: ctor,
67
enumerable: false,
68
writable: true,
69
configurable: true
70
}
71
});
72
}
73
74
inherit(exports.App, exports.EventEmitter2);
75
76
77