Changes from other editors
onChanges(handler) reports the nodes that clients of the API change, as { id, type, kind },
where kind is inserted, updated or deleted. A connection hears about the nodes its user can
read, and about every deletion. Changes made outside the API, by the site's own code or in the admin
UI, are not reported.
const off = store.onChanges(changes => {
if (changes.some(c => c.type === 'IProduct')) void reload();
});
const offResync = store.channel.onResync(() => void reload()); // the stream was down: changes may be lost
// call off() and offResync() when doneThe first subscription opens the event stream, which every store made with withContext() shares.
The stream reconnects by itself, but events sent while it was down are lost, so reload on
onResync. channel.onConnectionState reports connecting, open and closed, and
channel.disconnect() closes the stream. A module's own events (CmsApiEvents.Broadcast) arrive
through store.channel.subscribe(name, handler).