blob: 4ccb3da2043c5de6b8c69fc3b22c8e6d61c87135 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
(function() {
var Disposable, Grim;
Grim = require('grim');
module.exports = Disposable = (function() {
Disposable.prototype.disposed = false;
/*
Section: Construction and Destruction
*/
function Disposable(disposalAction) {
this.disposalAction = disposalAction;
}
Disposable.prototype.dispose = function() {
if (!this.disposed) {
this.disposed = true;
return typeof this.disposalAction === "function" ? this.disposalAction() : void 0;
}
};
Disposable.prototype.off = function() {
Grim.deprecate("Use ::dispose to cancel subscriptions instead of ::off");
return this.dispose();
};
return Disposable;
})();
}).call(this);
|