Interface: useEventBusType
@ima/react-page-renderer.useEventBusType
Properties
fire
• fire: (eventTarget
: EventTarget
, eventName
: string
, data?
: any
, options?
: EventBusOptions
) => EventBus
Type declaration
▸ (eventTarget
, eventName
, data?
, options?
): EventBus
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
Name | Type | Description |
---|---|---|
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 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