client/src/app.js
function (opts, callback) {
        var locale_promise, theme_promise,
            that = this;

        opts = opts || {};

        this.initUtils();

        // Set up the settings datastore
        _kiwi.global.settings = _kiwi.model.DataStore.instance('kiwi.settings');
        _kiwi.global.settings.load();

        // Set the window title
        window.document.title = opts.server_settings.client.window_title || 'Kiwi IRC';

        locale_promise = new Promise(function (resolve) {
            // In order, find a locale from the users saved settings, the URL, default settings on the server, or auto detect
            var locale = _kiwi.global.settings.get('locale') || opts.locale || opts.server_settings.client.settings.locale || 'magic';
            $.getJSON(opts.base_path + '/assets/locales/' + locale + '.json', function (locale) {
                if (locale) {
                    that.i18n = new Jed(locale);
                } else {
                    that.i18n = new Jed();
                }
                resolve();
            });
        });

        theme_promise = new Promise(function (resolve) {
            var text_theme = opts.server_settings.client.settings.text_theme || 'default';
            $.getJSON(opts.base_path + '/assets/text_themes/' + text_theme + '.json', function(text_theme) {
                opts.text_theme = text_theme;
                resolve();
            });
        });


        Promise.all([locale_promise, theme_promise]).then(function () {
            _kiwi.app = new _kiwi.model.Application(opts);

            // Start the client up
            _kiwi.app.initializeInterfaces();

            // Event emitter to let plugins interface with parts of kiwi
            _kiwi.global.events  = new PluginInterface();

            // Now everything has started up, load the plugin manager for third party plugins
            _kiwi.global.plugins = new _kiwi.model.PluginManager();

            callback();

        }).then(null, function(err) {
            console.error(err.stack);
        });
    }
function (opts, callback) {
        var locale_promise, theme_promise,
            that = this;

        opts = opts || {};

        this.initUtils();

        // Set up the settings datastore
        _kiwi.global.settings = _kiwi.model.DataStore.instance('kiwi.settings');
        _kiwi.global.settings.load();

        // Set the window title
        window.document.title = opts.server_settings.client.window_title || 'Kiwi IRC';

        locale_promise = new Promise(function (resolve) {
            // In order, find a locale from the users saved settings, the URL, default settings on the server, or auto detect
            var locale = _kiwi.global.settings.get('locale') || opts.locale || opts.server_settings.client.settings.locale || 'magic';
            $.getJSON(opts.base_path + '/assets/locales/' + locale + '.json', function (locale) {
                if (locale) {
                    that.i18n = new Jed(locale);
                } else {
                    that.i18n = new Jed();
                }
                resolve();
            });
        });

        theme_promise = new Promise(function (resolve) {
            var text_theme = opts.server_settings.client.settings.text_theme || 'default';
            $.getJSON(opts.base_path + '/assets/text_themes/' + text_theme + '.json', function(text_theme) {
                opts.text_theme = text_theme;
                resolve();
            });
        });


        Promise.all([locale_promise, theme_promise]).then(function () {
            _kiwi.app = new _kiwi.model.Application(opts);

            // Start the client up
            _kiwi.app.initializeInterfaces();

            // Event emitter to let plugins interface with parts of kiwi
            _kiwi.global.events  = new PluginInterface();

            // Now everything has started up, load the plugin manager for third party plugins
            _kiwi.global.plugins = new _kiwi.model.PluginManager();

            callback();

        }).then(null, function(err) {
            console.error(err.stack);
        });
    }
function ( opts , callback ) { var locale_promise , theme_promise , that = this ; opts = opts || { } ; this . initUtils ( ) ; // Set up the settings datastore
 _kiwi . global . settings = _kiwi . model . DataStore . instance ( 'kiwi.settings' ) ; _kiwi . global . settings . load ( ) ; // Set the window title
 window . document . title = opts . server_settings . client . window_title || 'Kiwi IRC' ; locale_promise = new Promise ( function ( resolve ) { // In order, find a locale from the users saved settings, the URL, default settings on the server, or auto detect
 var locale = _kiwi . global . settings . get ( 'locale' ) || opts . locale || opts . server_settings . client . settings . locale || 'magic' ; $ . getJSON ( opts . base_path + '/assets/locales/' + locale + '.json' , function ( locale ) { if ( locale ) { that . i18n = new Jed ( locale ) ; } else { that . i18n = new Jed ( ) ; } resolve ( ) ; } ) ; } ) ; theme_promise = new Promise ( function ( resolve ) { var text_theme = opts . server_settings . client . settings . text_theme || 'default' ; $ . getJSON ( opts . base_path + '/assets/text_themes/' + text_theme + '.json' , function ( text_theme ) { opts . text_theme = text_theme ; resolve ( ) ; } ) ; } ) ; Promise . all ( [ locale_promise , theme_promise ] ) . then ( function ( ) { _kiwi . app = new _kiwi . model . Application ( opts ) ; // Start the client up
 _kiwi . app . initializeInterfaces ( ) ; // Event emitter to let plugins interface with parts of kiwi
 _kiwi . global . events = new PluginInterface ( ) ; // Now everything has started up, load the plugin manager for third party plugins
 _kiwi . global . plugins = new _kiwi . model . PluginManager ( ) ; callback ( ) ; } ) . then ( null , function ( err ) { console . error ( err . stack ) ; } ) ; }
Entry point to start the kiwi application
Entry point to start the kiwi application