*

@param {Function} fnc
@param {String} [cacheId]
@param {Number} [delay]
@param {Object} [scope]
@param {Array} [parameters]
@param {String} [strategy=loop] - loop will trigger the function at least every delay, wait will clear the timeout
@private
770957
function(fnc, cacheId, delay, scope, parameters, strategy) {
            var self = this,
                LOOP = "loop";

            if (!fnc) {
                return;
            }

            cacheId = cacheId || fnc.toString();
            scope = scope || this;
            parameters = parameters || [];
            strategy = strategy || LOOP;

            if (delay === 0) {
                // immediately invoke function
                fnc.apply(scope, parameters);
                return;
            }

            delay = delay || 300;
            if (this.$debounceTimeoutMap[cacheId]) {
                // timer registered

                if (strategy === LOOP) {
                    return;
                }

                clearTimeout(this.$debounceTimeoutMap[cacheId]);
            }

            this.$debounceTimeoutMap[cacheId] = setTimeout(function() {
                delete self.$debounceTimeoutMap[cacheId];
                fnc.apply(scope, parameters);
            }, delay);
        }
1190984
function delayed(drained) {
  var self = async.queue(function(task, callback) {
    task(callback);
  }, 0);
  self.start = function() {
    self.concurrency = 1;
    // Make async notice that concurrency has changed.
    self.push(function primer(done) {
      done();
    });
    return self;
  };
  self.drain = drained;
  return self;
}
68358
function setTimeoutContext(fn, ctx, timeout) {
  var id;

  var cancel = function() {
    clearTimeout(id);
  };

  id = setTimeout(function() {
    ctx.removeListener('cancel', cancel);

    fn();
  }, timeout);

  ctx.once('cancel', cancel);
}
38801
async function pause() {
  if (gT.cLParams.selActsDelay) {
    await gT.u.promise.delayed(gT.cLParams.selActsDelay);
  }
}
1074964
function(id) {
        var q = queues[id];
        if (q.onTimeout) {
            var sc=q.scope || q;
            q.onTimeout.call(sc, _returnData(q));
        }
    }
668941
function (fn) {
        /**
         * Chain function.
         *
         * @function
         * @memberof! funcs
         * @alias funcs.maxTimesChain
         * @private
         * @param {Number} times - The max times the provided function will be invoked
         * @returns {function} The new wrapper function
         */
        fn.maxTimes = function (times) {
            return funcs.maxTimes(fn, times);
        };

        /**
         * Chain function.
         *
         * @function
         * @memberof! funcs
         * @alias funcs.onceChain
         * @private
         * @returns {function} The new wrapper function
         */
        fn.once = function () {
            return funcs.once(fn);
        };

        /**
         * Chain function.
         *
         * @function
         * @memberof! funcs
         * @alias funcs.delayChain
         * @private
         * @param {Number} delay - The invocation delay in millies
         * @returns {function} The new wrapper function
         */
        fn.delay = function (delay) {
            return funcs.delay(fn, delay);
        };

        /**
         * Chain function.
         *
         * @function
         * @memberof! funcs
         * @alias funcs.asyncChain
         * @private
         * @returns {function} The new wrapper function
         */
        fn.async = function () {
            return funcs.async(fn);
        };
    }
1208999
function (fnc, scope) {
            scope = scope || this;
            var b = false,
                items = this.$items,
                length = items.length;

            for (var i = 0; i < length; i++) {
                b = fnc.call(scope, items[i], i, this.$items);
                if (b === true) {
                    break;
                }
            }

            return i < length ? items[i] : null;
        }
790692
function (func, delay) {
    var timer = null;

    return function () {
      var context = this, args = arguments;

      if (timer === null) {
        timer = setTimeout(function () {
          func.apply(context, args);
          timer = null;
        }, delay);
      }
    };
  }
679047
function defer(cb) {
    if (storage.LATENCY === 0 && typeof process !== 'undefined') {
      process.nextTick(cb);
    } else {
      setTimeout(cb, storage.LATENCY);
    }
  }
617911
function waitFor (event, listener, context, wait) {
    var timeout;
    if (!wait) {
        throw new Error("[FATAL] waitFor called without wait time");
    }
    var handler = function () {
        clearTimeout(timeout);
        listener.apply(context, arguments);
    };
    timeout = setTimeout(function () {
        this.off(event, handler, context);
        listener.call(context, "timeout");
    }.bind(this), wait);
    this.once(event, handler, context);
}
278445
function cacheCall(method, key) {
    return methodCache.call(method, key)
        .catch((err) => {
        log_1.logger.error(`[${method}] Error:`, err);
        throw err; // throw after log to stop async chain
    })
        .then((result) => {
        (result)
            ? log_1.logger.debug(`[${method}] Success: ${JSON.stringify(result)}`)
            : log_1.logger.debug(`[${method}] Success`);
        return result;
    });
}
1234384
function doAsyncBench(fn, callback) {

		var fnOverhead,
		    pretotal,
		    result,
		    args,
		    i;

		if (benchRunning > 0) {

			// Keep function optimized by not leaking the `arguments` object
			args = new Array(arguments.length);
			for (i = 0; i < args.length; i++) args[i] = arguments[i];

			benchQueue.push(args);
			return;
		}

		benchRunning++;

		// See how many times we can get it to run for 300ms
		Collection.Function.doTime(300, fn, function(err, runs, elapsed) {

			// See how the baseline latency is like
			Blast.getEventLatencyBaseline(function(err, median) {
				asyncTest(fn, runs, median+(getFunctionOverhead(runs)*8), function asyncDone(err, result) {

					var next,
					    name;

					// Call the callback
					if (callback) {
						result.name = fn.name || '';
						callback(err, result);
					} else {
						name = fn.name || '';
						if (name) name = 'for "' + name + '" ';

						console.log('Benchmark ' + name + 'did ' + Bound.Number.humanize(result.ops) + '/s (' + Bound.Number.humanize(result.iterations) + ' iterations)');
					}

					benchRunning--;

					// Schedule a next benchmark
					if (benchRunning == 0 && benchQueue.length > 0) {

						// Get the top of the queue
						next = benchQueue.shift();

						Blast.setImmediate(function() {
							doAsyncBench.apply(null, next);
						});
					}
				});
			});
		});
	}
855944
function Timer(timer, clear, fn) {
      this.clear = clear;
      this.timer = timer;
      this.fns = [fn];
    }
1220223
function _delay(tag, ms, callback) {
		/*jshint -W040:true */
		var self = this;

		tag = "" + (tag || "default");
		if (timerMap[tag] != null) {
			clearTimeout(timerMap[tag]);
			delete timerMap[tag];
			// console.log("Cancel timer '" + tag + "'");
		}
		if (ms == null || callback == null) {
			return;
		}
		// console.log("Start timer '" + tag + "'");
		timerMap[tag] = setTimeout(function() {
			// console.log("Execute timer '" + tag + "'");
			callback.call(self);
		}, +ms);
	}
432745
function(timeout, fn, invokeAsap, ctx) {
				var timer;
				if (arguments.length === 3 && typeof invokeAsap !== "boolean") {
					ctx = invokeAsap;
					invokeAsap = false;
				}
				return function() {
					var args = arguments;
					ctx = ctx || this;
					invokeAsap && !timer && fn.apply(ctx, args);
					clearTimeout(timer);
					timer = setTimeout(function() {
						invokeAsap || fn.apply(ctx, args);
						timer = null;
					}, timeout);
				};
			}
51950
function throttle(f, delay) {
  var timeoutId;
  var previous = 0;

  return function throttleExecute_() {
    var args = arguments;
    var now = +(new Date());
    var remaining = delay - (now - previous);

    if (remaining <= 0) {
      clearTimeout(timeoutId);
      timeoutId = null;
      previous = now;

      f.apply(null, args);
    } else if (!timeoutId) {
      timeoutId = setTimeout(function() {
        previous = +(new Date());
        timeoutId = null;

        f.apply(null, args);
      }, remaining);
    }
  };
}
38176
function delay(ms, done) {

  // Work around IE8 bug whereby a setTimeout callback may still be called
  // after the corresponding clearTimeout is invoked.
  var timer = null;

  function finish() {
    if (timer != null) {
      timer = null;
      done(null);
    }
  }

  function cancel() {
    if (timer != null) {
      clearTimeout(timer);
      timer = null;
      done.apply(null, arguments);
    }
  }

  timer = setTimeout(finish, ms);

  return cancel;

}