]> git.r.bdr.sh - rbdr/dotfiles/blame - atom/packages/ex-mode/node_modules/event-kit/lib/disposable.js
Merge remote-tracking branch 'origin/master'
[rbdr/dotfiles] / atom / packages / ex-mode / node_modules / event-kit / lib / disposable.js
CommitLineData
24c7594d
BB
1(function() {
2 var Disposable, Grim;
3
4 Grim = require('grim');
5
6 module.exports = Disposable = (function() {
7 Disposable.prototype.disposed = false;
8
9
10 /*
11 Section: Construction and Destruction
12 */
13
14 function Disposable(disposalAction) {
15 this.disposalAction = disposalAction;
16 }
17
18 Disposable.prototype.dispose = function() {
19 if (!this.disposed) {
20 this.disposed = true;
21 return typeof this.disposalAction === "function" ? this.disposalAction() : void 0;
22 }
23 };
24
25 Disposable.prototype.off = function() {
26 Grim.deprecate("Use ::dispose to cancel subscriptions instead of ::off");
27 return this.dispose();
28 };
29
30 return Disposable;
31
32 })();
33
34}).call(this);