Skip to main content

Interface: useDispatcherType

Defined in: packages/react-page-renderer/src/hooks/dispatcher.ts:10

Properties

fire()

fire: <E>(event, data) => this(event, data) => this

Defined in: packages/react-page-renderer/src/hooks/dispatcher.ts:11

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

The method will synchronously execute all event listeners registered for the specified event, passing the provided data to them as the first argument.

It will also execute all event listeners registered to listen to all events.

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.

Type Parameters

E extends keyof DispatcherEventsMap

Parameters

event

E

The name of the event to fire.

data

DispatcherEventsMap[E]

The data to pass to the event listeners.

Returns

this

This dispatcher.

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

The method will synchronously execute all event listeners registered for the specified event, passing the provided data to them as the first argument.

It will also execute all event listeners registered to listen to all events.

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.

Parameters

event

string

The name of the event to fire.

data

any

The data to pass to the event listeners.

Returns

this

This dispatcher.