a collection of utility functions


static defer(fn, scope) → {Number}

Executes a function as soon as the interpreter is idle (stack empty).

Name Type Attributes Description
fn function

The function to be deferred.

scope Object

The execution scope of the deferred function.

arguments... <optional>

Optional additional arguments to carry for the function.

Number -

id that can be used to clear the deferred function using clearTimeout

// execute myFunc() when the stack is empty,
// with the current context and 'myArgument' as parameter
me.utils.function.defer(fn, this, 'myArgument');

static throttle(fn, delay, no_trailing)

returns a function that, when invoked will only be triggered at most once during a given window of time

Name Type Description
fn function

the function to be throttled.

delay Number

The delay in ms

no_trailing no_trailing

disable the execution on the trailing edge