"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/event-kit/lib/composite-disposable.js" (8 Mar 2017, 1412 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 CompositeDisposable;
    3 
    4   module.exports = CompositeDisposable = (function() {
    5     CompositeDisposable.prototype.disposed = false;
    6 
    7 
    8     /*
    9     Section: Construction and Destruction
   10      */
   11 
   12     function CompositeDisposable() {
   13       var disposable, _i, _len;
   14       this.disposables = new Set;
   15       for (_i = 0, _len = arguments.length; _i < _len; _i++) {
   16         disposable = arguments[_i];
   17         this.add(disposable);
   18       }
   19     }
   20 
   21     CompositeDisposable.prototype.dispose = function() {
   22       if (!this.disposed) {
   23         this.disposed = true;
   24         this.disposables.forEach(function(disposable) {
   25           return disposable.dispose();
   26         });
   27         this.disposables = null;
   28       }
   29     };
   30 
   31 
   32     /*
   33     Section: Managing Disposables
   34      */
   35 
   36     CompositeDisposable.prototype.add = function() {
   37       var disposable, _i, _len;
   38       if (!this.disposed) {
   39         for (_i = 0, _len = arguments.length; _i < _len; _i++) {
   40           disposable = arguments[_i];
   41           this.disposables.add(disposable);
   42         }
   43       }
   44     };
   45 
   46     CompositeDisposable.prototype.remove = function(disposable) {
   47       if (!this.disposed) {
   48         this.disposables["delete"](disposable);
   49       }
   50     };
   51 
   52     CompositeDisposable.prototype.clear = function() {
   53       if (!this.disposed) {
   54         this.disposables.clear();
   55       }
   56     };
   57 
   58     return CompositeDisposable;
   59 
   60   })();
   61 
   62 }).call(this);