@lumino/disposable
Advanced tools
Comparing version 1.10.2 to 2.0.0-alpha.0
@@ -1,39 +0,8 @@ | ||
import { each } from '@lumino/algorithm'; | ||
import { Signal } from '@lumino/signaling'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
/* global Reflect, Promise */ | ||
var extendStatics = function(d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
// Copyright (c) Jupyter Development Team. | ||
/** | ||
* A disposable object which delegates to a callback function. | ||
*/ | ||
var DisposableDelegate = /** @class */ (function () { | ||
class DisposableDelegate { | ||
/** | ||
@@ -44,80 +13,64 @@ * Construct a new disposable delegate. | ||
*/ | ||
function DisposableDelegate(fn) { | ||
constructor(fn) { | ||
this._fn = fn; | ||
} | ||
Object.defineProperty(DisposableDelegate.prototype, "isDisposed", { | ||
/** | ||
* Test whether the delegate has been disposed. | ||
*/ | ||
get: function () { | ||
return !this._fn; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* Test whether the delegate has been disposed. | ||
*/ | ||
get isDisposed() { | ||
return !this._fn; | ||
} | ||
/** | ||
* Dispose of the delegate and invoke the callback function. | ||
*/ | ||
DisposableDelegate.prototype.dispose = function () { | ||
dispose() { | ||
if (!this._fn) { | ||
return; | ||
} | ||
var fn = this._fn; | ||
let fn = this._fn; | ||
this._fn = null; | ||
fn(); | ||
}; | ||
return DisposableDelegate; | ||
}()); | ||
} | ||
} | ||
/** | ||
* An observable disposable object which delegates to a callback function. | ||
*/ | ||
var ObservableDisposableDelegate = /** @class */ (function (_super) { | ||
__extends(ObservableDisposableDelegate, _super); | ||
function ObservableDisposableDelegate() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this._disposed = new Signal(_this); | ||
return _this; | ||
class ObservableDisposableDelegate extends DisposableDelegate { | ||
constructor() { | ||
super(...arguments); | ||
this._disposed = new Signal(this); | ||
} | ||
Object.defineProperty(ObservableDisposableDelegate.prototype, "disposed", { | ||
/** | ||
* A signal emitted when the delegate is disposed. | ||
*/ | ||
get: function () { | ||
return this._disposed; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* A signal emitted when the delegate is disposed. | ||
*/ | ||
get disposed() { | ||
return this._disposed; | ||
} | ||
/** | ||
* Dispose of the delegate and invoke the callback function. | ||
*/ | ||
ObservableDisposableDelegate.prototype.dispose = function () { | ||
dispose() { | ||
if (this.isDisposed) { | ||
return; | ||
} | ||
_super.prototype.dispose.call(this); | ||
super.dispose(); | ||
this._disposed.emit(undefined); | ||
Signal.clearData(this); | ||
}; | ||
return ObservableDisposableDelegate; | ||
}(DisposableDelegate)); | ||
} | ||
} | ||
/** | ||
* An object which manages a collection of disposable items. | ||
*/ | ||
var DisposableSet = /** @class */ (function () { | ||
function DisposableSet() { | ||
class DisposableSet { | ||
constructor() { | ||
this._isDisposed = false; | ||
this._items = new Set(); | ||
} | ||
Object.defineProperty(DisposableSet.prototype, "isDisposed", { | ||
/** | ||
* Test whether the set has been disposed. | ||
*/ | ||
get: function () { | ||
return this._isDisposed; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* Test whether the set has been disposed. | ||
*/ | ||
get isDisposed() { | ||
return this._isDisposed; | ||
} | ||
/** | ||
* Dispose of the set and the items it contains. | ||
@@ -128,3 +81,3 @@ * | ||
*/ | ||
DisposableSet.prototype.dispose = function () { | ||
dispose() { | ||
if (this._isDisposed) { | ||
@@ -134,7 +87,7 @@ return; | ||
this._isDisposed = true; | ||
this._items.forEach(function (item) { | ||
this._items.forEach(item => { | ||
item.dispose(); | ||
}); | ||
this._items.clear(); | ||
}; | ||
} | ||
/** | ||
@@ -147,5 +100,5 @@ * Test whether the set contains a specific item. | ||
*/ | ||
DisposableSet.prototype.contains = function (item) { | ||
contains(item) { | ||
return this._items.has(item); | ||
}; | ||
} | ||
/** | ||
@@ -159,5 +112,5 @@ * Add a disposable item to the set. | ||
*/ | ||
DisposableSet.prototype.add = function (item) { | ||
add(item) { | ||
this._items.add(item); | ||
}; | ||
} | ||
/** | ||
@@ -171,13 +124,12 @@ * Remove a disposable item from the set. | ||
*/ | ||
DisposableSet.prototype.remove = function (item) { | ||
remove(item) { | ||
this._items.delete(item); | ||
}; | ||
} | ||
/** | ||
* Remove all items from the set. | ||
*/ | ||
DisposableSet.prototype.clear = function () { | ||
clear() { | ||
this._items.clear(); | ||
}; | ||
return DisposableSet; | ||
}()); | ||
} | ||
} | ||
/** | ||
@@ -190,3 +142,3 @@ * The namespace for the `DisposableSet` class statics. | ||
* | ||
* @param items - The iterable or array-like object of interest. | ||
* @param items - The iterable object of interest. | ||
* | ||
@@ -196,6 +148,6 @@ * @returns A new disposable initialized with the given items. | ||
function from(items) { | ||
var set = new DisposableSet(); | ||
each(items, function (item) { | ||
let set = new DisposableSet(); | ||
for (const item of items) { | ||
set.add(item); | ||
}); | ||
} | ||
return set; | ||
@@ -208,20 +160,14 @@ } | ||
*/ | ||
var ObservableDisposableSet = /** @class */ (function (_super) { | ||
__extends(ObservableDisposableSet, _super); | ||
function ObservableDisposableSet() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this._disposed = new Signal(_this); | ||
return _this; | ||
class ObservableDisposableSet extends DisposableSet { | ||
constructor() { | ||
super(...arguments); | ||
this._disposed = new Signal(this); | ||
} | ||
Object.defineProperty(ObservableDisposableSet.prototype, "disposed", { | ||
/** | ||
* A signal emitted when the set is disposed. | ||
*/ | ||
get: function () { | ||
return this._disposed; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* A signal emitted when the set is disposed. | ||
*/ | ||
get disposed() { | ||
return this._disposed; | ||
} | ||
/** | ||
* Dispose of the set and the items it contains. | ||
@@ -232,12 +178,11 @@ * | ||
*/ | ||
ObservableDisposableSet.prototype.dispose = function () { | ||
dispose() { | ||
if (this.isDisposed) { | ||
return; | ||
} | ||
_super.prototype.dispose.call(this); | ||
super.dispose(); | ||
this._disposed.emit(undefined); | ||
Signal.clearData(this); | ||
}; | ||
return ObservableDisposableSet; | ||
}(DisposableSet)); | ||
} | ||
} | ||
/** | ||
@@ -250,3 +195,3 @@ * The namespace for the `ObservableDisposableSet` class statics. | ||
* | ||
* @param items - The iterable or array-like object of interest. | ||
* @param items - The iterable object of interest. | ||
* | ||
@@ -256,6 +201,6 @@ * @returns A new disposable initialized with the given items. | ||
function from(items) { | ||
var set = new ObservableDisposableSet(); | ||
each(items, function (item) { | ||
let set = new ObservableDisposableSet(); | ||
for (const item of items) { | ||
set.add(item); | ||
}); | ||
} | ||
return set; | ||
@@ -262,0 +207,0 @@ } |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@lumino/algorithm'), require('@lumino/signaling')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@lumino/algorithm', '@lumino/signaling'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lumino_disposable = {}, global.lumino_algorithm, global.lumino_signaling)); | ||
}(this, (function (exports, algorithm, signaling) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@lumino/signaling')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@lumino/signaling'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lumino_disposable = {}, global.lumino_signaling)); | ||
})(this, (function (exports, signaling) { 'use strict'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
/* global Reflect, Promise */ | ||
var extendStatics = function(d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
// Copyright (c) Jupyter Development Team. | ||
/** | ||
* A disposable object which delegates to a callback function. | ||
*/ | ||
var DisposableDelegate = /** @class */ (function () { | ||
class DisposableDelegate { | ||
/** | ||
@@ -47,80 +17,64 @@ * Construct a new disposable delegate. | ||
*/ | ||
function DisposableDelegate(fn) { | ||
constructor(fn) { | ||
this._fn = fn; | ||
} | ||
Object.defineProperty(DisposableDelegate.prototype, "isDisposed", { | ||
/** | ||
* Test whether the delegate has been disposed. | ||
*/ | ||
get: function () { | ||
return !this._fn; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* Test whether the delegate has been disposed. | ||
*/ | ||
get isDisposed() { | ||
return !this._fn; | ||
} | ||
/** | ||
* Dispose of the delegate and invoke the callback function. | ||
*/ | ||
DisposableDelegate.prototype.dispose = function () { | ||
dispose() { | ||
if (!this._fn) { | ||
return; | ||
} | ||
var fn = this._fn; | ||
let fn = this._fn; | ||
this._fn = null; | ||
fn(); | ||
}; | ||
return DisposableDelegate; | ||
}()); | ||
} | ||
} | ||
/** | ||
* An observable disposable object which delegates to a callback function. | ||
*/ | ||
var ObservableDisposableDelegate = /** @class */ (function (_super) { | ||
__extends(ObservableDisposableDelegate, _super); | ||
function ObservableDisposableDelegate() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this._disposed = new signaling.Signal(_this); | ||
return _this; | ||
class ObservableDisposableDelegate extends DisposableDelegate { | ||
constructor() { | ||
super(...arguments); | ||
this._disposed = new signaling.Signal(this); | ||
} | ||
Object.defineProperty(ObservableDisposableDelegate.prototype, "disposed", { | ||
/** | ||
* A signal emitted when the delegate is disposed. | ||
*/ | ||
get: function () { | ||
return this._disposed; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* A signal emitted when the delegate is disposed. | ||
*/ | ||
get disposed() { | ||
return this._disposed; | ||
} | ||
/** | ||
* Dispose of the delegate and invoke the callback function. | ||
*/ | ||
ObservableDisposableDelegate.prototype.dispose = function () { | ||
dispose() { | ||
if (this.isDisposed) { | ||
return; | ||
} | ||
_super.prototype.dispose.call(this); | ||
super.dispose(); | ||
this._disposed.emit(undefined); | ||
signaling.Signal.clearData(this); | ||
}; | ||
return ObservableDisposableDelegate; | ||
}(DisposableDelegate)); | ||
} | ||
} | ||
/** | ||
* An object which manages a collection of disposable items. | ||
*/ | ||
exports.DisposableSet = /** @class */ (function () { | ||
function DisposableSet() { | ||
class DisposableSet { | ||
constructor() { | ||
this._isDisposed = false; | ||
this._items = new Set(); | ||
} | ||
Object.defineProperty(DisposableSet.prototype, "isDisposed", { | ||
/** | ||
* Test whether the set has been disposed. | ||
*/ | ||
get: function () { | ||
return this._isDisposed; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* Test whether the set has been disposed. | ||
*/ | ||
get isDisposed() { | ||
return this._isDisposed; | ||
} | ||
/** | ||
* Dispose of the set and the items it contains. | ||
@@ -131,3 +85,3 @@ * | ||
*/ | ||
DisposableSet.prototype.dispose = function () { | ||
dispose() { | ||
if (this._isDisposed) { | ||
@@ -137,7 +91,7 @@ return; | ||
this._isDisposed = true; | ||
this._items.forEach(function (item) { | ||
this._items.forEach(item => { | ||
item.dispose(); | ||
}); | ||
this._items.clear(); | ||
}; | ||
} | ||
/** | ||
@@ -150,5 +104,5 @@ * Test whether the set contains a specific item. | ||
*/ | ||
DisposableSet.prototype.contains = function (item) { | ||
contains(item) { | ||
return this._items.has(item); | ||
}; | ||
} | ||
/** | ||
@@ -162,5 +116,5 @@ * Add a disposable item to the set. | ||
*/ | ||
DisposableSet.prototype.add = function (item) { | ||
add(item) { | ||
this._items.add(item); | ||
}; | ||
} | ||
/** | ||
@@ -174,13 +128,12 @@ * Remove a disposable item from the set. | ||
*/ | ||
DisposableSet.prototype.remove = function (item) { | ||
remove(item) { | ||
this._items.delete(item); | ||
}; | ||
} | ||
/** | ||
* Remove all items from the set. | ||
*/ | ||
DisposableSet.prototype.clear = function () { | ||
clear() { | ||
this._items.clear(); | ||
}; | ||
return DisposableSet; | ||
}()); | ||
} | ||
} | ||
/** | ||
@@ -193,3 +146,3 @@ * The namespace for the `DisposableSet` class statics. | ||
* | ||
* @param items - The iterable or array-like object of interest. | ||
* @param items - The iterable object of interest. | ||
* | ||
@@ -199,31 +152,25 @@ * @returns A new disposable initialized with the given items. | ||
function from(items) { | ||
var set = new DisposableSet(); | ||
algorithm.each(items, function (item) { | ||
let set = new DisposableSet(); | ||
for (const item of items) { | ||
set.add(item); | ||
}); | ||
} | ||
return set; | ||
} | ||
DisposableSet.from = from; | ||
})(exports.DisposableSet || (exports.DisposableSet = {})); | ||
})(DisposableSet || (DisposableSet = {})); | ||
/** | ||
* An observable object which manages a collection of disposable items. | ||
*/ | ||
exports.ObservableDisposableSet = /** @class */ (function (_super) { | ||
__extends(ObservableDisposableSet, _super); | ||
function ObservableDisposableSet() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this._disposed = new signaling.Signal(_this); | ||
return _this; | ||
class ObservableDisposableSet extends DisposableSet { | ||
constructor() { | ||
super(...arguments); | ||
this._disposed = new signaling.Signal(this); | ||
} | ||
Object.defineProperty(ObservableDisposableSet.prototype, "disposed", { | ||
/** | ||
* A signal emitted when the set is disposed. | ||
*/ | ||
get: function () { | ||
return this._disposed; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* A signal emitted when the set is disposed. | ||
*/ | ||
get disposed() { | ||
return this._disposed; | ||
} | ||
/** | ||
* Dispose of the set and the items it contains. | ||
@@ -234,12 +181,11 @@ * | ||
*/ | ||
ObservableDisposableSet.prototype.dispose = function () { | ||
dispose() { | ||
if (this.isDisposed) { | ||
return; | ||
} | ||
_super.prototype.dispose.call(this); | ||
super.dispose(); | ||
this._disposed.emit(undefined); | ||
signaling.Signal.clearData(this); | ||
}; | ||
return ObservableDisposableSet; | ||
}(exports.DisposableSet)); | ||
} | ||
} | ||
/** | ||
@@ -252,3 +198,3 @@ * The namespace for the `ObservableDisposableSet` class statics. | ||
* | ||
* @param items - The iterable or array-like object of interest. | ||
* @param items - The iterable object of interest. | ||
* | ||
@@ -258,17 +204,19 @@ * @returns A new disposable initialized with the given items. | ||
function from(items) { | ||
var set = new ObservableDisposableSet(); | ||
algorithm.each(items, function (item) { | ||
let set = new ObservableDisposableSet(); | ||
for (const item of items) { | ||
set.add(item); | ||
}); | ||
} | ||
return set; | ||
} | ||
ObservableDisposableSet.from = from; | ||
})(exports.ObservableDisposableSet || (exports.ObservableDisposableSet = {})); | ||
})(ObservableDisposableSet || (ObservableDisposableSet = {})); | ||
exports.DisposableDelegate = DisposableDelegate; | ||
exports.DisposableSet = DisposableSet; | ||
exports.ObservableDisposableDelegate = ObservableDisposableDelegate; | ||
exports.ObservableDisposableSet = ObservableDisposableSet; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
})); | ||
//# sourceMappingURL=index.js.map |
@@ -1,16 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lumino/algorithm"),require("@lumino/signaling")):"function"==typeof define&&define.amd?define(["exports","@lumino/algorithm","@lumino/signaling"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lumino_disposable={},e.lumino_algorithm,e.lumino_signaling)}(this,(function(e,t,i){"use strict"; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},o(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var s,r,p=function(){function e(e){this._fn=e}return Object.defineProperty(e.prototype,"isDisposed",{get:function(){return!this._fn},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){if(this._fn){var e=this._fn;this._fn=null,e()}},e}(),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._disposed=new i.Signal(t),t}return n(t,e),Object.defineProperty(t.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this.isDisposed||(e.prototype.dispose.call(this),this._disposed.emit(void 0),i.Signal.clearData(this))},t}(p);e.DisposableSet=function(){function e(){this._isDisposed=!1,this._items=new Set}return Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this._isDisposed||(this._isDisposed=!0,this._items.forEach((function(e){e.dispose()})),this._items.clear())},e.prototype.contains=function(e){return this._items.has(e)},e.prototype.add=function(e){this._items.add(e)},e.prototype.remove=function(e){this._items.delete(e)},e.prototype.clear=function(){this._items.clear()},e}(),(s=e.DisposableSet||(e.DisposableSet={})).from=function(e){var i=new s;return t.each(e,(function(e){i.add(e)})),i},e.ObservableDisposableSet=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._disposed=new i.Signal(t),t}return n(t,e),Object.defineProperty(t.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this.isDisposed||(e.prototype.dispose.call(this),this._disposed.emit(void 0),i.Signal.clearData(this))},t}(e.DisposableSet),(r=e.ObservableDisposableSet||(e.ObservableDisposableSet={})).from=function(e){var i=new r;return t.each(e,(function(e){i.add(e)})),i},e.DisposableDelegate=p,e.ObservableDisposableDelegate=u,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(s,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@lumino/signaling")):"function"==typeof define&&define.amd?define(["exports","@lumino/signaling"],e):e((s="undefined"!=typeof globalThis?globalThis:s||self).lumino_disposable={},s.lumino_signaling)}(this,(function(s,e){"use strict";class i{constructor(s){this._fn=s}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let s=this._fn;this._fn=null,s()}}class t{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach((s=>{s.dispose()})),this._items.clear())}contains(s){return this._items.has(s)}add(s){this._items.add(s)}remove(s){this._items.delete(s)}clear(){this._items.clear()}}!function(s){s.from=function(e){let i=new s;for(const s of e)i.add(s);return i}}(t||(t={}));class o extends t{constructor(){super(...arguments),this._disposed=new e.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),e.Signal.clearData(this))}}!function(s){s.from=function(e){let i=new s;for(const s of e)i.add(s);return i}}(o||(o={})),s.DisposableDelegate=i,s.DisposableSet=t,s.ObservableDisposableDelegate=class extends i{constructor(){super(...arguments),this._disposed=new e.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),e.Signal.clearData(this))}},s.ObservableDisposableSet=o,Object.defineProperty(s,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "@lumino/disposable", | ||
"version": "1.10.2", | ||
"version": "2.0.0-alpha.0", | ||
"description": "Lumino Disposable", | ||
@@ -14,9 +14,3 @@ "homepage": "https://github.com/jupyterlab/lumino", | ||
"license": "BSD-3-Clause", | ||
"author": "S. Chris Colbert <sccolbert@gmail.com>", | ||
"contributors": [ | ||
"A. T. Darian <git@darian.email>", | ||
"Dave Willmer <dave.willmer@gmail.com>", | ||
"S. Chris Colbert <sccolbert@gmail.com>", | ||
"Steven Silvester <steven.silvester@gmail.com>" | ||
], | ||
"author": "Project Jupyter", | ||
"main": "dist/index.js", | ||
@@ -39,3 +33,2 @@ "jsdelivr": "dist/index.min.js", | ||
"clean:test": "rimraf tests/build", | ||
"docs": "typedoc --options tdoptions.json src", | ||
"minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js", | ||
@@ -50,8 +43,12 @@ "test": "npm run test:firefox-headless", | ||
}, | ||
"typedoc": { | ||
"entryPoint": "./src/index.ts", | ||
"displayName": "disposable" | ||
}, | ||
"dependencies": { | ||
"@lumino/algorithm": "^1.9.2", | ||
"@lumino/signaling": "^1.10.2" | ||
"@lumino/signaling": "^2.0.0-alpha.0" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.6.0", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"@types/chai": "^3.4.35", | ||
@@ -67,13 +64,13 @@ "@types/mocha": "^2.2.39", | ||
"mocha": "^9.0.3", | ||
"postcss": "^8.4.14", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.56.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-postcss": "^4.0.0", | ||
"rollup": "^2.77.2", | ||
"rollup-plugin-postcss": "^4.0.2", | ||
"rollup-plugin-sourcemaps": "^0.6.3", | ||
"terser": "^5.7.1", | ||
"tslib": "^2.3.0", | ||
"typedoc": "~0.15.0", | ||
"typescript": "~3.6.0", | ||
"webpack": "^4.41.3", | ||
"webpack-cli": "^3.3.10" | ||
"tslib": "^2.4.0", | ||
"typedoc": "~0.23.9", | ||
"typescript": "~4.7.3", | ||
"webpack": "^5.74.0", | ||
"webpack-cli": "^4.10.0" | ||
}, | ||
@@ -80,0 +77,0 @@ "publishConfig": { |
@@ -10,4 +10,2 @@ // Copyright (c) Jupyter Development Team. | ||
|----------------------------------------------------------------------------*/ | ||
import { each, IterableOrArrayLike } from '@lumino/algorithm'; | ||
import { ISignal, Signal } from '@lumino/signaling'; | ||
@@ -91,3 +89,4 @@ | ||
extends DisposableDelegate | ||
implements IObservableDisposable { | ||
implements IObservableDisposable | ||
{ | ||
/** | ||
@@ -196,11 +195,11 @@ * A signal emitted when the delegate is disposed. | ||
* | ||
* @param items - The iterable or array-like object of interest. | ||
* @param items - The iterable object of interest. | ||
* | ||
* @returns A new disposable initialized with the given items. | ||
*/ | ||
export function from(items: IterableOrArrayLike<IDisposable>): DisposableSet { | ||
export function from(items: Iterable<IDisposable>): DisposableSet { | ||
let set = new DisposableSet(); | ||
each(items, item => { | ||
for (const item of items) { | ||
set.add(item); | ||
}); | ||
} | ||
return set; | ||
@@ -215,3 +214,4 @@ } | ||
extends DisposableSet | ||
implements IObservableDisposable { | ||
implements IObservableDisposable | ||
{ | ||
/** | ||
@@ -249,15 +249,13 @@ * A signal emitted when the set is disposed. | ||
* | ||
* @param items - The iterable or array-like object of interest. | ||
* @param items - The iterable object of interest. | ||
* | ||
* @returns A new disposable initialized with the given items. | ||
*/ | ||
export function from( | ||
items: IterableOrArrayLike<IDisposable> | ||
): ObservableDisposableSet { | ||
export function from(items: Iterable<IDisposable>): ObservableDisposableSet { | ||
let set = new ObservableDisposableSet(); | ||
each(items, item => { | ||
for (const item of items) { | ||
set.add(item); | ||
}); | ||
} | ||
return set; | ||
} | ||
} |
@@ -1,2 +0,1 @@ | ||
import { IterableOrArrayLike } from '@lumino/algorithm'; | ||
import { ISignal } from '@lumino/signaling'; | ||
@@ -49,3 +48,3 @@ /** | ||
*/ | ||
readonly isDisposed: boolean; | ||
get isDisposed(): boolean; | ||
/** | ||
@@ -64,3 +63,3 @@ * Dispose of the delegate and invoke the callback function. | ||
*/ | ||
readonly disposed: ISignal<this, void>; | ||
get disposed(): ISignal<this, void>; | ||
/** | ||
@@ -79,3 +78,3 @@ * Dispose of the delegate and invoke the callback function. | ||
*/ | ||
readonly isDisposed: boolean; | ||
get isDisposed(): boolean; | ||
/** | ||
@@ -128,7 +127,7 @@ * Dispose of the set and the items it contains. | ||
* | ||
* @param items - The iterable or array-like object of interest. | ||
* @param items - The iterable object of interest. | ||
* | ||
* @returns A new disposable initialized with the given items. | ||
*/ | ||
function from(items: IterableOrArrayLike<IDisposable>): DisposableSet; | ||
function from(items: Iterable<IDisposable>): DisposableSet; | ||
} | ||
@@ -142,3 +141,3 @@ /** | ||
*/ | ||
readonly disposed: ISignal<this, void>; | ||
get disposed(): ISignal<this, void>; | ||
/** | ||
@@ -160,8 +159,7 @@ * Dispose of the set and the items it contains. | ||
* | ||
* @param items - The iterable or array-like object of interest. | ||
* @param items - The iterable object of interest. | ||
* | ||
* @returns A new disposable initialized with the given items. | ||
*/ | ||
function from(items: IterableOrArrayLike<IDisposable>): ObservableDisposableSet; | ||
function from(items: Iterable<IDisposable>): ObservableDisposableSet; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1
0
51663
23
9
804
1
2
+ Added@lumino/algorithm@2.0.2(transitive)
+ Added@lumino/coreutils@2.2.0(transitive)
+ Added@lumino/signaling@2.1.3(transitive)
- Removed@lumino/algorithm@^1.9.2
- Removed@lumino/algorithm@1.9.2(transitive)
- Removed@lumino/properties@1.8.2(transitive)
- Removed@lumino/signaling@1.11.1(transitive)