0.2.1 • Published 3 years ago
disposable-events v0.2.1
disposable-events
What does it do
Disposables are convenient ways to represent a resource you will no longer need at some point. You can instantiate a disposable with an action to take when no longer needed.
Inspired by the atom's event-kit
How do you use it
Coming soon™️
DisposableCollection
You can use DisposableCollection to combine disposable instances together.
const { Disposable, DisposableCollection } = require('disposable-events')
const subscriptions = new DisposableCollection()
subscriptions.add(
new Disposable(() => alert('asd')),
new Disposable(() => alert('basd'))
)
// Later, to unsubscribe from *both*...
subscriptions.dispose()
0.2.1
3 years ago