An object that aggregates multiple Disposable instances together into a single disposable, so they can all be disposed as a group.
These are very useful when subscribing to multiple events.
[CompositeDisposable](../CompositeDisposable/) = require 'atom'
class Something
constructor: ->
@disposables = new CompositeDisposable
editor = atom.workspace.getActiveTextEditor()
@disposables.add editor.onDidChange ->
@disposables.add editor.onDidChangePath ->
destroy: ->
@disposables.dispose()
Construct an instance, optionally with one or more disposables
Dispose all disposables added to this composite disposable.
If this object has already been disposed, this method has no effect.
Add a disposable to be disposed when the composite is disposed.
If this object has already been disposed, this method has no effect.
Argument | Description |
---|---|
|
Disposable instance or any object with a |
Remove a previously added disposable.
Argument | Description |
---|---|
|
Disposable instance or any object with a |
Clear all disposables. They will not be disposed by the next call to dispose.