subscribeNotices()function

subscribeNotices(callback: (message: ReactNode, status?: Status | undefined) => void, el: EventTarget = window): () => void
ParamType
callback(message: ReactNode, status?: Status
undefined) => void
Called with the message and status each time a notice event fires. required
elEventTarget
Element to subscribe on (defaults to window). Defaults to window
Return
() => void
An unsubscribe function that removes the listener.

Subscribe to notice events on an element and call a callback when they happen.

  • Stops propagation so the notice is not handled again by a higher subscriber.

Examples

const stop = subscribeNotices((message, status) => show(message, status));