Commit | Line | Data |
---|---|---|
eaaf73b0 | 1 | // Holds anything kiwi client specific (ie. front, gateway, _kiwi.plugs..)\r |
9df70c63 D |
2 | /**\r |
3 | * @namespace\r | |
4 | */\r | |
eaaf73b0 | 5 | var _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 | |
46 | if (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 | } |