Skip to main content

Interface: useEventBusType

Defined in: packages/react-page-renderer/src/hooks/eventBus.ts:6

Properties​

fire()​

fire: (eventTarget, eventName, data?, options?) => this

Defined in: packages/react-page-renderer/src/hooks/eventBus.ts:7

Fires a new custom event of the specified name, carrying the provided data.

Note that this method does not prevent the event listeners to modify the data in any way. The order in which the event listeners will be executed is unspecified and should not be relied upon.

Note that the default options are { bubbles: true, cancelable: true }, which is different from the default values used in the native custom events ({ bubbles: false, cancelable: false }).

Parameters​

eventTarget​

EventTarget

The event target at which the event will be dispatched (e.g. element/document/window).

eventName​

string

The name of the event to fire.

data?​

any

The data to pass to the event listeners.

options?​

EventBusOptions

The override of the default options passed to the constructor of the custom event fired by this event bus. The default options passed to the custom event constructor are { bubbles: true, cancelable: true }.

Returns​

this

This custom event bus.

Throws​

Thrown if the provided event target cannot be used to fire the event.

See​

https://developer.mozilla.org/en-US/docs/Web/API/Event/Event