dw.system
Class HookMgr
Object
dw.system.HookMgr
This class provides functionality to call hooks. A hook is an extension point in the business logic, where you can register scripts to customize functionality.
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
static callHook(extensionPoint : String, function : String, args : Object...) : Object
Calls a hook on base of the specified extensionPoint and function.
static hasHook(extensionPoint : String) : boolean
Checks whether a hook is registered or a system default implementation exists for this extension point.
Methods inherited from class Object
Method Detail
callHook
static callHook(extensionPoint : String, function : String, args : Object...) : Object
Calls a hook on base of the specified extensionPoint and function. If a hook throws an exception, then this method will also throw an exception. If no hook and no system default implementation is provided, then this method will return undefined.

Sample:

 dw.system.HookMgr.callHook( "dw.order.calculate", "calculate", basket );
 

Parameters:
extensionPoint - the extension point to call
function - the script function to call
args - the Array of function parameters
Returns:
the object returned by the hook or undefined

hasHook
static hasHook(extensionPoint : String) : boolean
Checks whether a hook is registered or a system default implementation exists for this extension point.

extensionPoint refers to the same name used to register a script as implementation. With this method it's only possible to check for a whole script registered but it is not possible to check, whether an individual function is implemented.

Sample:

 dw.system.HookMgr.hasHook( "dw.order.calculate" );
 

Parameters:
extensionPoint - the extension point
Returns:
true, if a hook is registered or a default implementation exists, otherwise false

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. By continuing to use this site you are giving us your consent to do this.