directus-extension-ax-collection-changes-monitor
v1.0.4
Published
Extension that simplifies notifying connected clients about collection-data changes, and also supports external change notifications.
Maintainers
Readme
Extension that simplifies notifying connected clients about collection-data changes, and also supports external change notifications.
Usage
Commands avaliable from client:
directus.registerChangeListener- register change notificationsdirectus.unRegisterChangeListener- unregister change notificationsdirectus.externalModification- notify external change (you need to send data as {collection,action,id})
Example of usage:
const directusSdk = await this.parent.getDirectusSdk();
directusSdk.onWebSocket("message", (ev) =>
{
if (ev?.type == "directus.dataChanged")
{
console.log(`Directus: Data ${ev.action} - ${ev.collection}:${ev.id}. Cache cleared.`);
this.clearCache();
}
});
directusSdk.sendMessage({ type: "directus.registerChangeListener" });Versions
- 1.0.4 updated example
- 1.0.3 updated example
- 1.0.2 added usage example, fixed close notification for non-registered clients
- 1.0.1 created readme
- 1.0.0 initial commit
