From 1e9f97d64f53bc59f4bd69383701b314aacabdac Mon Sep 17 00:00:00 2001 From: Darren Date: Mon, 16 Jun 2014 14:37:57 +0100 Subject: [PATCH] Selected helper functions available via kiwi.utils --- client/src/app.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client/src/app.js b/client/src/app.js index 2b7b0af..c9863af 100644 --- a/client/src/app.js +++ b/client/src/app.js @@ -19,7 +19,18 @@ _kiwi.global = { settings: undefined, // Instance of _kiwi.model.DataStore plugins: undefined, // Instance of _kiwi.model.PluginManager events: undefined, // Instance of PluginInterface - utils: {}, // TODO: Re-usable methods + utils: {}, // References to misc. re-usable helpers / functions + + initUtils: function() { + this.utils.randomString = randomString; + this.utils.secondsToTime = secondsToTime; + this.utils.parseISO8601 = parseISO8601; + this.utils.escapeRegex = escapeRegex; + this.utils.formatIRCMsg = formatIRCMsg; + this.utils.styleText = styleText; + this.utils.hsl2rgb = hsl2rgb; + }, + rpc: function() { _kiwi.gateway.rpc.call.call(_kiwi.gateway.rpc, arguments); }, @@ -136,6 +147,8 @@ _kiwi.global = { var jobs, locale, localeLoaded, textThemeLoaded, text_theme; opts = opts || {}; + this.initUtils(); + jobs = new JobManager(); jobs.onFinish(function(locale, s, xhr) { _kiwi.app = new _kiwi.model.Application(opts); -- 2.25.1