Wix.PubSub

publish

publish(eventName, data, isPersistent)

Broadcasts an event to other Site components of a multicomponent app. If the app’s Site components span multiple pages, they will be notified when they are rendered.

Note:
For the Worker component, use the Worker.PubSub.publish method instead.

Parameters:

NameTypeDescription

Example:

subscribe

subscribe(eventName, callBack, [receivePastEvents])

Subscribes to events from other site components of a multicomponent app. If the components span multiple pages, they will be notified once they are rendered. It is also possible to receive all notifications prior to rendering by specifying a flag when subscribing to events. If the flag is set, the component will be notified immediately of any prior events of the type it is registered to receive.

Note:
For the Worker component, use the Worker.PubSub.subscribe method instead.

Parameters:

Name TypeDescription

Example:

unsubscribe

unsubscribe(eventName, function)

Unsubscribes from receiving further events. The id from the initial subscribe call is used to unsubscribe from further notifications.

Parameters:

NameTypeDescription

Example:

Was this page helpful?

What can we do to improve it?

What did you like about it?