Selected helper functions available via kiwi.utils
authorDarren <darren@darrenwhitlen.com>
Mon, 16 Jun 2014 13:37:57 +0000 (14:37 +0100)
committerDarren <darren@darrenwhitlen.com>
Mon, 16 Jun 2014 13:37:57 +0000 (14:37 +0100)
client/src/app.js

index 2b7b0af7016c93ddff7b259535fa8253379b2c87..c9863af205f9af6360cf035b3b4b38603accaf77 100644 (file)
@@ -19,7 +19,18 @@ _kiwi.global = {
     settings: undefined, // Instance of _kiwi.model.DataStore\r
     plugins: undefined, // Instance of _kiwi.model.PluginManager\r
     events: undefined, // Instance of PluginInterface\r
-    utils: {}, // TODO: Re-usable methods\r
+    utils: {}, // References to misc. re-usable helpers / functions\r
+\r
+    initUtils: function() {\r
+        this.utils.randomString = randomString;\r
+        this.utils.secondsToTime = secondsToTime;\r
+        this.utils.parseISO8601 = parseISO8601;\r
+        this.utils.escapeRegex = escapeRegex;\r
+        this.utils.formatIRCMsg = formatIRCMsg;\r
+        this.utils.styleText = styleText;\r
+        this.utils.hsl2rgb = hsl2rgb;\r
+    },\r
+\r
     rpc: function() {\r
         _kiwi.gateway.rpc.call.call(_kiwi.gateway.rpc, arguments);\r
     },\r
@@ -136,6 +147,8 @@ _kiwi.global = {
         var jobs, locale, localeLoaded, textThemeLoaded, text_theme;\r
         opts = opts || {};\r
 \r
+        this.initUtils();\r
+\r
         jobs = new JobManager();\r
         jobs.onFinish(function(locale, s, xhr) {\r
             _kiwi.app = new _kiwi.model.Application(opts);\r