Function that'll call next on the queue & the callback
181762
function done(err) {

			that._gcw = 'done_get_creatures';

			bomb.defuse();

			// Unsee the 'getting_creatures' event
			that.unsee('getting_creatures');

			// Call next on the next tick (in case we call back with an error)
			Blast.nextTick(next);

			if (err) {
				that.log('error', 'Error getting creatures: ' + err)
				callback(err);
			} else {

				let result = [];

				for (let id in that.creatures_by_id) {
					if (that.creatures_by_id[id]) {
						result.push(that.creatures_by_id[id]);
					}
				}

				callback(null, result);
				that.emit('_got_creatures', err, result);
			}
		}
1195935
function next(cursor, callback) {
  // Return the currentDoc if someone called hasNext first
  if (cursor.s.currentDoc) {
    const doc = cursor.s.currentDoc;
    cursor.s.currentDoc = null;
    return callback(null, doc);
  }

  // Return the next object
  nextObject(cursor, callback);
}
702283
function(step, next) {
      var SpawnState, oldNext, state;
      state = null;
      SpawnState = (function() {

        function SpawnState(step, callback) {
          this.callback = callback;
          this.spawn = __bind(this.spawn, this);

          this.threadCount = -1;
          this.returnedThreads = -1;
          this.returnValues = {};
        }

        SpawnState.prototype.spawn = function() {
          var threadId,
            _this = this;
          this.threadCount++;
          threadId = this.threadCount;
          return function() {
            if (_this.returnValues[threadId] != null) {
              throw "A spawn's callback can not be called multiple times!";
            }
            _this.returnValues[threadId] = ((function() {
              switch (arguments.length) {
                case 0:
                  return null;
                case 1:
                  return arguments[0];
                default:
                  return copyArray(arguments);
              }
            }).apply(_this, arguments));
            _this.returnedThreads++;
            return _this.checkIfAllReturned();
          };
        };

        SpawnState.prototype.checkIfAllReturned = function() {
          if (this.returnValues.length && this.returnedThreads === this.threadCount) {
            this.callback.apply(null, copyArray(this.returnValues));
            return state = null;
          }
        };

        SpawnState.prototype.doneSpawning = function() {
          this.returnValues.length = this.threadCount + 1;
          return this.checkIfAllReturned();
        };

        return SpawnState;

      })();
      oldNext = step.next;
      step.spawn = function() {
        if (!state) {
          state = new SpawnState(step, oldNext);
        }
        return state.spawn();
      };
      step.next = function() {
        if (state === null) {
          return oldNext.apply(null, arguments);
        } else {
          return state.doneSpawning();
        }
      };
      return next();
    }
1324827
function checkQueue() {
    if(!inInterval()) {
      if(requestQueue.length) {
        var next = requestQueue.shift();
        sendRequest(next);
      } else if(timer) {
        clearInterval(timer); // No need to leave the timer running if we don't have any requests.
      }
    }
  }
1074964
function(id) {
        var q = queues[id];
        if (q.onTimeout) {
            var sc=q.scope || q;
            q.onTimeout.call(sc, _returnData(q));
        }
    }
913423
function iterateOverCallbacks(bucket, args) {
    bucket.forEach(function iterator(callback) {
        nextTick(function queuedCallback() {
            callback.apply(null, args);
        });
    });
}
484230
def run(self):
        
        while True:
            msg = self._queue.get()
            if msg is _SHUTDOWN:
                break
            event, args, kwargs = msg
            self._logger('<< %s', event)
            for func in self._callbacks.get(event, []):
                func(*args, **kwargs)
949052
def _call_next(self, handler_chain):
        

        def wrapped(*args, **kwargs):
            if len(handler_chain) == 1:
                return handler_chain[0](*args, **kwargs)
            else:
                return handler_chain[0](self._call_next(handler_chain[1:]),
                                        *args, **kwargs)

        return wrapped
731383
function callbackWrapper() {
					callback && callback.apply( this, arguments );

					// Removed the just loaded script from the queue.
					pending.shift();

					loadNext.call( that );
				}
1034275
function asyncFunction(a, b, callback) {
    process.nextTick(function(){
        callback(null, a + b);
    })
}
409471
function(callback) {
    if (typeof callback === 'function') {
      this.afterSync(callback);
    }

    if (this.pendingSync) {
      clearTimeout(this.pendingSync.pop());
      this.pendingSync.forEach(this.cancelQueue);
      this.pendingSync = null;
    }

    if (this.syncing) {
      this.rerun = true;
      return false;
    }

    this.runSync();
    return true;
  }
1048619
function(source, callback) {
        callback = callback || noop;

        //if there's a queue
        if (queue[source] instanceof Array) {
            //just add it
            return queue[source].push(callback);
        }

        //otherwise there is not a queue
        //so let's create one
        queue[source] = [callback];

        var script = document.createElement('script');
        var head = document.getElementsByTagName('head')[0];

        script.async = 1;

        head.appendChild(script);

        script.onload = script.onreadystatechange = function( _, isAbort ) {
            if(isAbort || !script.readyState || /loaded|complete/.test(script.readyState) ) {
                script.onload = script.onreadystatechange = null;
                script = undefined;

                if(!isAbort) {
                    queue[source].forEach(function(callback) {
                        callback();
                    });

                    delete queue[source];
                }
            }
        };

        script.src = source;
    }
935356
function async(func)
{
  function wrapper()
  {
    var context = this;
    var args    = arguments;
    process.nextTick(function()
    {
      func.apply(context, args);
    });
  }

  return wrapper;
}
362127
function(callee, input) {
		for (var i = 0, len = this._queue.length; i < len; ++i)
			input = this._queue[i].call(callee, input);
		return input;
	}
827500
function next(err, cb) {
    if (typeof err === 'function') {
      debug('pushed filter callback');
      cb = err;
      err = null;
    }
    if (typeof cb === "function") callbacks.push(cb);

    debug('call middleware index', index);
    var layer = stack[index++];

    // No more middlewares or early end.
    if (!layer || ended) {
      debug('middleware-s call done');
      fn = callbacks.pop();
      while (fn) {
        err = fn(err, ctx);
        if (err) break;
        fn = callbacks.pop();
      }
      if (out) return out(err, ctx);
      if (err) throw err;
      return;
    }

    // Check if middleware type matches or if it has no type.
    if (layer.type.length > 0 && layer.type.indexOf(type) < 0) {
      return next(err);
    }

    try {
      var arity = layer.handle.length;
      //if err, only execute error middlewares
      if (err) {
        //error middlewares have an arity of 3, the first
        //arg being the error
        if (arity === 3) {
          layer.handle(err, ctx, next);
        } else {
          next(err);
        }
      } else if (arity < 2) {
        layer.handle(ctx);
        if (!ended) next();
      } else if (arity < 3) {
        layer.handle(ctx, next);
      } else {
        next();
      }
    }
    catch (e) {
      next(e);
    }
  }
49572
function after(count, callback) {
    var countdown = count;

    return function shim(err) {
        if (typeof callback !== 'function') return;

        if (err) {
            callback(err);
            callback = null;
            return;
        }

        if (--countdown === 0) {
            callback();
            callback = null;
        }
    };
}
573081
function(callback) {

      var self = this;

      this.queue.add(function() {
        if (callback) {
          callback(self.error, self._getUrl()); 
        }
      });

    }