Client: Private `kiwi` namespace renamed to `_kiwi`
[KiwiIRC.git] / client / assets / dev / app.js
CommitLineData
eaaf73b0 1// Holds anything kiwi client specific (ie. front, gateway, _kiwi.plugs..)\r
9df70c63
D
2/**\r
3* @namespace\r
4*/\r
eaaf73b0 5var _kiwi = {};\r
9df70c63 6\r
eaaf73b0
D
7_kiwi.model = {};\r
8_kiwi.view = {};\r
9_kiwi.applets = {};\r
b62c8381
D
10\r
11\r
12/**\r
13 * A global container for third party access\r
14 * Will be used to access a limited subset of kiwi functionality\r
15 * and data (think: plugins)\r
16 */\r
eaaf73b0 17_kiwi.global = {\r
721ad945 18 utils: undefined, // Re-usable methods\r
b62c8381
D
19 gateway: undefined,\r
20 user: undefined,\r
21 server: undefined,\r
721ad945
D
22 command: undefined, // The control box\r
23\r
24 // TODO: think of a better term for this as it will also refer to queries\r
b62c8381
D
25 channels: undefined,\r
26\r
27 // Entry point to start the kiwi application\r
28 start: function (opts) {\r
29 opts = opts || {};\r
30\r
eaaf73b0 31 _kiwi.app = new _kiwi.model.Application(opts);\r
b62c8381
D
32\r
33 if (opts.kiwi_server) {\r
eaaf73b0 34 _kiwi.app.kiwi_server = opts.kiwi_server;\r
b62c8381
D
35 }\r
36\r
eaaf73b0 37 _kiwi.app.start();\r
b62c8381
D
38\r
39 return true;\r
721ad945 40 }\r
b62c8381
D
41};\r
42\r
43\r
44\r
45// If within a closure, expose the kiwi globals\r
46if (typeof global !== 'undefined') {\r
eaaf73b0
D
47 global.kiwi = _kiwi.global;\r
48} else {\r
49 // Not within a closure so set a var in the current scope\r
50 var kiwi = _kiwi.global;\r
b62c8381 51}