dw.system
Class HookMgr
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
Methods inherited from class
Object
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Method Detail
callHook
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