WLEvent.registerScope()

Overview

Register a function to be run when a specific scope is entered. For information on Velocity scopes, see Understanding scopes.

Added in version 1.2.0

See Also

Format

var reference = WLEvent.registerScope(scope, funcRef, objectInstance, paramArray);

Parameter Description Type Required Notes
scope The name of the scope for which the specified function will be invoked. String Required See Understanding scopes.
funcRef The function to invoke when the specified scope is entered. Function Required
objectInstance The value of this provided for the call to funcRef. Object Required This parameter may be null.
paramArray An array of parameters to pass to the specified function when it is invoked. Array Required
reference An object returned from the registration that can be used to unregister at a future point. Object Returned Should be saved if the registration will be removed in the future.

Example

Copy
/* The onError function is registered to the "session" scope.
 */
 
function doOnSession(param1, param2) {
    Logger.debug("doOnSession(" + param1 + "," + param2 + ")");
}
 
WLEvent.registerScope("session", doOnSession, null, ["value1", 2]);