"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/emissary/lib/subscription.js" (7 Feb 2017, 1267 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 (function() {
    2   var Emitter, Subscription,
    3     __hasProp = {}.hasOwnProperty,
    4     __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
    5 
    6   Emitter = require('./emitter');
    7 
    8   module.exports = Subscription = (function(_super) {
    9     __extends(Subscription, _super);
   10 
   11     Subscription.prototype.cancelled = false;
   12 
   13     function Subscription(emitter, eventNames, handler) {
   14       this.emitter = emitter;
   15       this.eventNames = eventNames;
   16       this.handler = handler;
   17     }
   18 
   19     Subscription.prototype.off = function() {
   20       return this.dispose();
   21     };
   22 
   23     Subscription.prototype.dispose = function() {
   24       var unsubscribe, _ref;
   25       if (this.cancelled) {
   26         return;
   27       }
   28       unsubscribe = (_ref = this.emitter.off) != null ? _ref : this.emitter.removeListener;
   29       unsubscribe.call(this.emitter, this.eventNames, this.handler);
   30       this.emitter = null;
   31       this.handler = null;
   32       this.cancelled = true;
   33       return this.emit('cancelled');
   34     };
   35 
   36     return Subscription;
   37 
   38   })(Emitter);
   39 
   40 }).call(this);