client/src/models/network.js
function (channels) {
            var that = this,
                panels = [];

            // Multiple channels may come as comma-delimited
            if (typeof channels === 'string') {
                channels = channels.split(',');
            }

            $.each(channels, function (index, channel_name_key) {
                // We may have a channel key so split it off
                var spli = channel_name_key.trim().split(' '),
                    channel_name = spli[0],
                    channel_key = spli[1] || '';

                // Trim any whitespace off the name
                channel_name = channel_name.trim();

                // Add channel_prefix in front of the first channel if missing
                if (that.get('channel_prefix').indexOf(channel_name[0]) === -1) {
                    // Could be many prefixes but '#' is highly likely the required one
                    channel_name = '#' + channel_name;
                }

                // Check if we have the panel already. If not, create it
                channel = that.panels.getByName(channel_name);
                if (!channel) {
                    channel = new _kiwi.model.Channel({name: channel_name, network: that, key: channel_key||undefined});
                    that.panels.add(channel);
                }

                panels.push(channel);

                that.gateway.join(channel_name, channel_key);
            });


            return panels;
        }
function (channels) {
            var that = this,
                panels = [];

            // Multiple channels may come as comma-delimited
            if (typeof channels === 'string') {
                channels = channels.split(',');
            }

            $.each(channels, function (index, channel_name_key) {
                // We may have a channel key so split it off
                var spli = channel_name_key.trim().split(' '),
                    channel_name = spli[0],
                    channel_key = spli[1] || '';

                // Trim any whitespace off the name
                channel_name = channel_name.trim();

                // Add channel_prefix in front of the first channel if missing
                if (that.get('channel_prefix').indexOf(channel_name[0]) === -1) {
                    // Could be many prefixes but '#' is highly likely the required one
                    channel_name = '#' + channel_name;
                }

                // Check if we have the panel already. If not, create it
                channel = that.panels.getByName(channel_name);
                if (!channel) {
                    channel = new _kiwi.model.Channel({name: channel_name, network: that, key: channel_key||undefined});
                    that.panels.add(channel);
                }

                panels.push(channel);

                that.gateway.join(channel_name, channel_key);
            });


            return panels;
        }
function ( channels ) { var that = this , panels = [ ] ; // Multiple channels may come as comma-delimited if ( typeof channels === 'string' ) { channels = channels . split ( ',' ) ; } $ . each ( channels , function ( index , channel_name_key ) { // We may have a channel key so split it off var spli = channel_name_key . trim ( ) . split ( ' ' ) , channel_name = spli [ 0 ] , channel_key = spli [ 1 ] || '' ; // Trim any whitespace off the name channel_name = channel_name . trim ( ) ; // Add channel_prefix in front of the first channel if missing if ( that . get ( 'channel_prefix' ) . indexOf ( channel_name [ 0 ] ) === - 1 ) { // Could be many prefixes but '#' is highly likely the required one channel_name = '#' + channel_name ; } // Check if we have the panel already. If not, create it channel = that . panels . getByName ( channel_name ) ; if ( ! channel ) { channel = new _kiwi . model . Channel ( { name : channel_name , network : that , key : channel_key || undefined } ) ; that . panels . add ( channel ) ; } panels . push ( channel ) ; that . gateway . join ( channel_name , channel_key ) ; } ) ; return panels ; }
Create panels and join the channel
This will not wait for the join event to create a panel. This
increases responsiveness in case of network lag
Create panels and join the channel This will not wait for the join event to create a panel . This increases responsiveness in case of network lag