Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@reactive-js/disposable

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reactive-js/disposable - npm Package Compare versions

Comparing version 0.0.31 to 0.0.32

4

dist/cjs/index.d.ts

@@ -21,1 +21,5 @@ export interface ErrorLike {

export declare const createSerialDisposable: () => SerialDisposableLike;
export interface DisposableWrapperLike<T> extends DisposableLike {
value: T;
}
export declare const createDisposableWrapper: <T>(value: T, cleanup: (v: T) => void) => DisposableWrapperLike<T>;

34

dist/cjs/index.js

@@ -18,3 +18,3 @@ "use strict";

this.isDisposed = false;
this.disposables = [];
this.disposables = new Set();
this.error = undefined;

@@ -27,10 +27,7 @@ }

}
else if (!disposables.includes(disposable)) {
disposables.push(disposable);
else if (!disposables.has(disposable)) {
disposables.add(disposable);
if (!(disposable instanceof Function)) {
disposable.add(() => {
const index = disposables.indexOf(disposable);
if (index > -1) {
disposables.splice(index, 1);
}
disposables.delete(disposable);
});

@@ -46,6 +43,5 @@ }

const disposables = this.disposables;
let disposable = disposables.shift();
while (disposable !== undefined) {
for (const disposable of disposables) {
disposables.delete(disposable);
doDispose(disposable, error);
disposable = disposables.shift();
}

@@ -84,5 +80,4 @@ }

this.add = add;
this.disposable = exports.createDisposable(() => { this.isDisposed = true; });
this.disposable = exports.createDisposable();
this.dispose = dispose;
this.isDisposed = false;
}

@@ -92,2 +87,5 @@ get inner() {

}
get isDisposed() {
return this.disposable.isDisposed;
}
set inner(newInner) {

@@ -108,2 +106,14 @@ if (this.isDisposed) {

exports.createSerialDisposable = () => new SerialDisposableImpl();
class DisposableWrapperImpl {
constructor(value) {
this.value = value;
this.add = add;
this.disposable = exports.createDisposable();
this.dispose = dispose;
}
get isDisposed() {
return this.disposable.isDisposed;
}
}
exports.createDisposableWrapper = (value, cleanup) => new DisposableWrapperImpl(value).add(() => cleanup(value));
//# sourceMappingURL=index.js.map

@@ -21,1 +21,5 @@ export interface ErrorLike {

export declare const createSerialDisposable: () => SerialDisposableLike;
export interface DisposableWrapperLike<T> extends DisposableLike {
value: T;
}
export declare const createDisposableWrapper: <T>(value: T, cleanup: (v: T) => void) => DisposableWrapperLike<T>;

@@ -16,3 +16,3 @@ const doDispose = (disposable, error) => {

this.isDisposed = false;
this.disposables = [];
this.disposables = new Set();
this.error = undefined;

@@ -25,10 +25,7 @@ }

}
else if (!disposables.includes(disposable)) {
disposables.push(disposable);
else if (!disposables.has(disposable)) {
disposables.add(disposable);
if (!(disposable instanceof Function)) {
disposable.add(() => {
const index = disposables.indexOf(disposable);
if (index > -1) {
disposables.splice(index, 1);
}
disposables.delete(disposable);
});

@@ -44,6 +41,5 @@ }

const disposables = this.disposables;
let disposable = disposables.shift();
while (disposable !== undefined) {
for (const disposable of disposables) {
disposables.delete(disposable);
doDispose(disposable, error);
disposable = disposables.shift();
}

@@ -80,5 +76,4 @@ }

this.add = add;
this.disposable = createDisposable(() => { this.isDisposed = true; });
this.disposable = createDisposable();
this.dispose = dispose;
this.isDisposed = false;
}

@@ -88,2 +83,5 @@ get inner() {

}
get isDisposed() {
return this.disposable.isDisposed;
}
set inner(newInner) {

@@ -104,2 +102,14 @@ if (this.isDisposed) {

export const createSerialDisposable = () => new SerialDisposableImpl();
class DisposableWrapperImpl {
constructor(value) {
this.value = value;
this.add = add;
this.disposable = createDisposable();
this.dispose = dispose;
}
get isDisposed() {
return this.disposable.isDisposed;
}
}
export const createDisposableWrapper = (value, cleanup) => new DisposableWrapperImpl(value).add(() => cleanup(value));
//# sourceMappingURL=index.js.map

@@ -21,2 +21,6 @@ export interface ErrorLike {

export declare const createSerialDisposable: () => SerialDisposableLike;
export interface DisposableWrapperLike<T> extends DisposableLike {
value: T;
}
export declare const createDisposableWrapper: <T>(value: T, cleanup: (v: T) => void) => DisposableWrapperLike<T>;
//# sourceMappingURL=index.d.ts.map
{
"name": "@reactive-js/disposable",
"version": "0.0.31",
"version": "0.0.32",
"main": "dist/cjs/index.js",

@@ -65,3 +65,3 @@ "module": "dist/esm5/index.js",

},
"gitHead": "c950e60d18f5bb13f5890123c05728b4edf9c3c0"
"gitHead": "352c7637c9ea06b52a8407b8d167e57fde1fa239"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc