mixins/PeriodicActions.js
function (uuid, action, params, interval) {
        var actions = null;

        if (typeof uuid !== 'string' ||
            typeof action !== 'function') {
            return false;
        }

        if (interval === undefined) {
            if (typeof params === 'number') {
                interval = params;
                params = null;
            } else {
                interval = 100;
            }
        }

        if (uuidMap[uuid]) {
            return false;
        }

        if (!intervalsMap[interval]) {
            actions = [];
            intervalsMap[interval] = {
                id: setInterval(getIntervalRunner(this.context, actions), interval),
                interval: interval,
                actions: actions
            };
        }

        intervalsMap[interval].actions.push({
            uuid: uuid,
            action: action,
            params: params
        });
        uuidMap[uuid] = intervalsMap[interval];

        if (!this._periodicActionUUIDs) {
            this._periodicActionUUIDs = [];
        }

        this._periodicActionUUIDs.push(uuid);
        return true;
    }
function (uuid, action, params, interval) {
        var actions = null;

        if (typeof uuid !== 'string' ||
            typeof action !== 'function') {
            return false;
        }

        if (interval === undefined) {
            if (typeof params === 'number') {
                interval = params;
                params = null;
            } else {
                interval = 100;
            }
        }

        if (uuidMap[uuid]) {
            return false;
        }

        if (!intervalsMap[interval]) {
            actions = [];
            intervalsMap[interval] = {
                id: setInterval(getIntervalRunner(this.context, actions), interval),
                interval: interval,
                actions: actions
            };
        }

        intervalsMap[interval].actions.push({
            uuid: uuid,
            action: action,
            params: params
        });
        uuidMap[uuid] = intervalsMap[interval];

        if (!this._periodicActionUUIDs) {
            this._periodicActionUUIDs = [];
        }

        this._periodicActionUUIDs.push(uuid);
        return true;
    }
function ( uuid , action , params , interval ) { var actions = null ; if ( typeof uuid !== 'string' || typeof action !== 'function' ) { return false ; } if ( interval === undefined ) { if ( typeof params === 'number' ) { interval = params ; params = null ; } else { interval = 100 ; } } if ( uuidMap [ uuid ] ) { return false ; } if ( ! intervalsMap [ interval ] ) { actions = [ ] ; intervalsMap [ interval ] = { id : setInterval ( getIntervalRunner ( this . context , actions ) , interval ) , interval : interval , actions : actions } ; } intervalsMap [ interval ] . actions . push ( { uuid : uuid , action : action , params : params } ) ; uuidMap [ uuid ] = intervalsMap [ interval ] ; if ( ! this . _periodicActionUUIDs ) { this . _periodicActionUUIDs = [ ] ; } this . _periodicActionUUIDs . push ( uuid ) ; return true ; }
Start running an action periodically

@method  startPeriodicAction

@param  {string} uuid A globally unique identifier

@param  {Function} action The action to run

@param  {(Object|Array|string|number|boolean)} [params=undefined] The parameters to pass to the action

@param  {number} [interval=100] The amount of time to wait between action executions

@return {boolean} True if adding the periodic action succeeded, false otherwise
Start running an action periodically