Skip to content


This helper function may be used to add a listener on a hook.

When called inside a Vue component, the listener will unregister itself automatically when the component is unmounted.

RelatedPlugins, Hooks


registerHook takes two mandatory arguments: the name of the hook, and a callback that takes as a parameter the data from this hook.

It returns another function that will unregister the hook.

When the once option is set to true, the hook will only be executed once.

registerHook('navigated', ({ payload }) => {
  console.log(`Navigated to ${payload.url}`)
}, { once: true })