From: Darren Date: Mon, 16 Jun 2014 13:37:57 +0000 (+0100) Subject: Selected helper functions available via kiwi.utils X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1e9f97d64f53bc59f4bd69383701b314aacabdac;p=KiwiIRC.git Selected helper functions available via kiwi.utils --- 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);