src/lib/notification-list.js
function (username, channel) {
        var userChannels = this.getUserNotifications(username);

        // if the user doesn't already have an entry add one
        if (userChannels === null) {
            userChannels = [];

            // update the user to add them to the latest videos list
            this.latestVideos.getLatestVideos(username);

            this.notifications.push({
                username: username,
                channels: userChannels
            });
        }

        // dont allow duplicate channel names
        if (userChannels.indexOf(channel) !== -1) {
            return false;
        }

        // add the channel to the user and save data
        userChannels.push(channel);
        this.saveNotifications();
        return true;
    }
function (username, channel) {
        var userChannels = this.getUserNotifications(username);

        // if the user doesn't already have an entry add one
        if (userChannels === null) {
            userChannels = [];

            // update the user to add them to the latest videos list
            this.latestVideos.getLatestVideos(username);

            this.notifications.push({
                username: username,
                channels: userChannels
            });
        }

        // dont allow duplicate channel names
        if (userChannels.indexOf(channel) !== -1) {
            return false;
        }

        // add the channel to the user and save data
        userChannels.push(channel);
        this.saveNotifications();
        return true;
    }
function ( username , channel ) { var userChannels = this . getUserNotifications ( username ) ; // if the user doesn't already have an entry add one if ( userChannels === null ) { userChannels = [ ] ; // update the user to add them to the latest videos list this . latestVideos . getLatestVideos ( username ) ; this . notifications . push ( { username : username , channels : userChannels } ) ; } // dont allow duplicate channel names if ( userChannels . indexOf ( channel ) !== - 1 ) { return false ; } // add the channel to the user and save data userChannels . push ( channel ) ; this . saveNotifications ( ) ; return true ; }
Adds the given username to the list of names for notifications

@param {string} username - The account name to check for
@param {string} channel - The channel to send the notification to
@returns {boolean} true if added, false if already in the list
Adds the given username to the list of names for notifications