Function.createCallback Function

Creates a callback function that retains the parameter initially used during an objects creation.

var a = objVar.createCallback(method,context);

Arguments

  • method
    The function for which the callback is created.

  • context
    The parameter for the function.

Return Value

A callback function.

Remarks

Use the createCallback function to create a callback function that retains the parameter initially used during the objects creation. The callback is used without a parameter, however this function will call the actual function with the parameter. The createCallback function is useful when setting up a handler for a DOM event that must retain a parameter despite the DOM event handler needing to be a function with the event object as the only parameter. This allows the function to be called with the event as the first parameter and the context as the second parameter. If the callback is called with an arbitrary list of parameters, the context is appended.

See Also

Other Resources

Language Reference