]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/event-kit/lib/composite-disposable.js
4235b96605b25f40e7ca5c074cbee18b5202946b
2 var CompositeDisposable
;
4 module
.exports
= CompositeDisposable
= (function() {
5 CompositeDisposable
.prototype.disposed
= false;
9 Section: Construction and Destruction
12 function CompositeDisposable() {
13 var disposable
, _i
, _len
;
14 this.disposables
= [];
15 for (_i
= 0, _len
= arguments
.length
; _i
< _len
; _i
++) {
16 disposable
= arguments
[_i
];
21 CompositeDisposable
.prototype.dispose = function() {
22 var disposable
, _i
, _len
, _ref
;
25 _ref
= this.disposables
;
26 for (_i
= 0, _len
= _ref
.length
; _i
< _len
; _i
++) {
27 disposable
= _ref
[_i
];
36 Section: Managing Disposables
39 CompositeDisposable
.prototype.add = function(disposable
) {
41 return this.disposables
.push(disposable
);
45 CompositeDisposable
.prototype.remove = function(disposable
) {
47 index
= this.disposables
.indexOf(disposable
);
49 return this.disposables
.splice(index
, 1);
53 CompositeDisposable
.prototype.clear = function() {
54 return this.disposables
.length
= 0;
57 return CompositeDisposable
;