Built-In Namespace Function
| Method Attributes | Method Name and Description |
|---|---|
|
bind(context, args)
ensure bind is properly supported
(c) Prototype.js Binds this function to the given context by wrapping it in another function and returning the wrapper. |
|
|
defer()
Executes a function as soon as the interpreter is idle (stack empty).
|
Method Detail
bind(context, args)
ensure bind is properly supported
(c) Prototype.js
(c) Prototype.js
Binds this function to the given context by wrapping it in another function and returning the wrapper.
Whenever the resulting "bound" function is called, it will call the original ensuring that this is set to context.
Also optionally curries arguments for the function.
Defined in: <build/melonJS-0.9.3.js>.
// A typical use of Function bind is to ensure that a callback // (event handler, etc.) that is an object method gets called with // the correct object as its context (this value): // -> WRONG myObject.onComplete(this.callback); // -> RIGHT myObject.onComplete(this.callback.bind(this));
- Parameters:
- {Object} context
- the object to bind to.
-
{Array.
} args Optional - Optional additional arguments to curry for the function.
defer()
Executes a function as soon as the interpreter is idle (stack empty).
Defined in: <build/melonJS-0.9.3.js>.
Defined in: <build/melonJS-0.9.3.js>.
// execute myFunc() when the stack is empty, with 'myArgument' as parameter
myFunc.defer('myArgument');
- Returns:
- id that can be used to clear the deferred function using clearTimeout