src/Scheduler.js
function (opts) {
        var target   = opts.target,
            priority = opts.priority,
            paused   = opts.paused

        var i, len
        var entry = {target: target, priority: priority, paused: paused}
        var added = false

        if (priority === 0) {
            this.updates0.push(entry)
        } else if (priority < 0) {
            for (i = 0, len = this.updatesNeg.length; i < len; i++) {
                if (priority < this.updatesNeg[i].priority) {
                    this.updatesNeg.splice(i, 0, entry)
                    added = true
                    break
                }
            }

            if (!added) {
                this.updatesNeg.push(entry)
            }
        } else /* priority > 0 */{
            for (i = 0, len = this.updatesPos.length; i < len; i++) {
                if (priority < this.updatesPos[i].priority) {
                    this.updatesPos.splice(i, 0, entry)
                    added = true
                    break
                }
            }

            if (!added) {
                this.updatesPos.push(entry)
            }
        }

        this.hashForUpdates[target.id] = entry
    }
function (opts) {
        var target   = opts.target,
            priority = opts.priority,
            paused   = opts.paused

        var i, len
        var entry = {target: target, priority: priority, paused: paused}
        var added = false

        if (priority === 0) {
            this.updates0.push(entry)
        } else if (priority < 0) {
            for (i = 0, len = this.updatesNeg.length; i < len; i++) {
                if (priority < this.updatesNeg[i].priority) {
                    this.updatesNeg.splice(i, 0, entry)
                    added = true
                    break
                }
            }

            if (!added) {
                this.updatesNeg.push(entry)
            }
        } else /* priority > 0 */{
            for (i = 0, len = this.updatesPos.length; i < len; i++) {
                if (priority < this.updatesPos[i].priority) {
                    this.updatesPos.splice(i, 0, entry)
                    added = true
                    break
                }
            }

            if (!added) {
                this.updatesPos.push(entry)
            }
        }

        this.hashForUpdates[target.id] = entry
    }
function ( opts ) { var target = opts . target , priority = opts . priority , paused = opts . paused var i , len var entry = { target : target , priority : priority , paused : paused } var added = false if ( priority === 0 ) { this . updates0 . push ( entry ) } else if ( priority < 0 ) { for ( i = 0 , len = this . updatesNeg . length ; i < len ; i ++ ) { if ( priority < this . updatesNeg [ i ] . priority ) { this . updatesNeg . splice ( i , 0 , entry ) added = true break } } if ( ! added ) { this . updatesNeg . push ( entry ) } } else /* priority > 0 */ { for ( i = 0 , len = this . updatesPos . length ; i < len ; i ++ ) { if ( priority < this . updatesPos [ i ] . priority ) { this . updatesPos . splice ( i , 0 , entry ) added = true break } } if ( ! added ) { this . updatesPos . push ( entry ) } } this . hashForUpdates [ target . id ] = entry }
Schedules the 'update' selector for a given target with a given priority.
The 'update' selector will be called every frame.
The lower the priority, the earlier it is called.
Schedules the update selector for a given target with a given priority . The update selector will be called every frame . The lower the priority the earlier it is called .