Skip to content

omphalos.event.raise

function omphalos.event.raise(event, data)

Send a named event message to all assets in the current bundle; data can be any desired value, so long as it is JSON-encodeable.

To send a message to items in a different bundle, use omphalos.event.raiseToBundle() instead.

The message will be transmitted to all graphic, panel and extension listeners in the current bundle, except for the sender, and can be listened for via omphalos.event.on().

Raising intra-bundle events
// Listen for an event in the current bundle
const unlisten = omphalos.event.on('my-event', (payload) => {
omphalos.log.info(`Got event with data: ${payload.some}`);
});
// Listen for an event from a specific external bundle
const unlistenExt = omphalos.event.on('their-event', 'other-bundle', (payload) => {
omphalos.log.info(`Got external event with data: ${payload.some}`);
});
// Raise an event to peers in the current bundle
omphalos.event.raise('my-event', { some: 'data' });
// Raise an event to peers in a specific external bundle
omphalos.event.raiseToBundle('their-event', 'other-bundle', { some: 'data' });