src/yaku.core.js
function genScheduler (initQueueSize, fn) {
        /**
         * All async promise will be scheduled in
         * here, so that they can be execute on the next tick.
         * @private
         */
        var fnQueue = Arr(initQueueSize)
            , fnQueueLen = 0;

        /**
         * Run all queued functions.
         * @private
         */
        function flush () {
            var i = 0;
            while (i < fnQueueLen) {
                fn(fnQueue[i], fnQueue[i + 1]);
                fnQueue[i++] = $undefined;
                fnQueue[i++] = $undefined;
            }

            fnQueueLen = 0;
            if (fnQueue.length > initQueueSize) fnQueue.length = initQueueSize;
        }

        return function (v, arg) {
            fnQueue[fnQueueLen++] = v;
            fnQueue[fnQueueLen++] = arg;

            if (fnQueueLen === 2) nextTick(flush);
        };
    }
function genScheduler (initQueueSize, fn) {
        /**
         * All async promise will be scheduled in
         * here, so that they can be execute on the next tick.
         * @private
         */
        var fnQueue = Arr(initQueueSize)
            , fnQueueLen = 0;

        /**
         * Run all queued functions.
         * @private
         */
        function flush () {
            var i = 0;
            while (i < fnQueueLen) {
                fn(fnQueue[i], fnQueue[i + 1]);
                fnQueue[i++] = $undefined;
                fnQueue[i++] = $undefined;
            }

            fnQueueLen = 0;
            if (fnQueue.length > initQueueSize) fnQueue.length = initQueueSize;
        }

        return function (v, arg) {
            fnQueue[fnQueueLen++] = v;
            fnQueue[fnQueueLen++] = arg;

            if (fnQueueLen === 2) nextTick(flush);
        };
    }
function genScheduler ( initQueueSize , fn ) { /**
         * All async promise will be scheduled in
         * here, so that they can be execute on the next tick.
         * @private
         */ var fnQueue = Arr ( initQueueSize ) , fnQueueLen = 0 ; /**
         * Run all queued functions.
         * @private
         */ function flush ( ) { var i = 0 ; while ( i < fnQueueLen ) { fn ( fnQueue [ i ] , fnQueue [ i + 1 ] ) ; fnQueue [ i ++ ] = $undefined ; fnQueue [ i ++ ] = $undefined ; } fnQueueLen = 0 ; if ( fnQueue . length > initQueueSize ) fnQueue . length = initQueueSize ; } return function ( v , arg ) { fnQueue [ fnQueueLen ++ ] = v ; fnQueue [ fnQueueLen ++ ] = arg ; if ( fnQueueLen === 2 ) nextTick ( flush ) ; } ; }
Generate a scheduler.
@private
@param  {Integer}  initQueueSize
@param  {Function} fn `(Yaku, Value) ->` The schedule handler.
@return {Function} `(Yaku, Value) ->` The scheduler.
Generate a scheduler .