addHook(hook)
Adds a hook.
Hook is added to the end of the list. See getHooks method and hooks in plugins.
Arguments
hook
(Hook): An object withevent
andhandler
properties. See plugins for more info.
Throws
If
event
is not a string, it will throw an errorHook's event must be a string.
If
event
doesn't begin withpre
orpost
, it will throw an errorHook's event must start with 'pre' or 'post'.
If
handler
is not a function, it will throw an errorHook's handler must be a function.
Example
Last updated