@composi/datastore:

Unwatch

Unwatch an Event

There might arise a situation where you want a watcher for a specific period of time, after which you don't want it to function any longer. You can do this using the unwatch method. This takes one argument: the event to unwatch.

dataStore.watch('temp-event', () => {
  console.log('This event will not be watched much longer!')
})
// Sometime later:
dataStore.unwatch('temp-event')
// Now if you send that event, nothing will happen:
dataStore.send('temp-event')