Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
phosphor-disposable
Advanced tools
A module for expressing the disposable object pattern.
Prerequisites
npm install --save phosphor-disposable
Prerequisites
git clone https://github.com/phosphorjs/phosphor-disposable.git
cd phosphor-disposable
npm install
Rebuild
npm run clean
npm run build
Follow the source build instructions first.
npm test
Follow the source build instructions first.
npm run docs
Navigate to docs/index.html
.
The runtime versions which are currently known to work are listed below. Earlier versions may also work, but come with no guarantees.
Follow the package install instructions first.
npm install --save-dev browserify
browserify myapp.js -o mybundle.js
Note: This module is fully compatible with Node/Babel/ES6/ES5. Simply omit the type declarations when using a language other than TypeScript.
import {
DisposableDelegate, DisposableSet, IDisposable
} from 'phosphor-disposable';
// Convert a function into a disposable.
let delegate = new DisposableDelegate(() => {
console.log('disposed');
});
delegate.dispose(); // logs: 'disposed'
delegate.dispose(); // no-op
// Create a collection of disposables.
let d1 = new DisposableDelegate(() => {
console.log('one');
});
let d2 = new DisposableDelegate(() => {
console.log('two');
});
let d3 = new DisposableDelegate(() => {
console.log('three');
});
let set = new DisposableSet([d1, d2, d3]);
set.dispose(); // logs: 'one', 'two', 'three'
set.dispose(); // no-op
// Create a custom disposable.
class MyDisposable implements IDisposable {
constructor(id: string) {
this._id = id;
}
get isDisposed(): boolean {
return this._id === null;
}
dispose(): void {
if (this._id !== null) {
console.log(this._id);
this._id = null;
}
}
private _id: string;
}
let foo = new MyDisposable('foo');
let bar = new MyDisposable('bar');
let baz = new MyDisposable('baz');
let set = new DisposableSet();
set.add(foo);
set.add(bar);
set.add(baz);
set.dispose(); // logs: 'foo', 'bar', 'baz'
set.dispose(); // no-op
FAQs
A module for expressing the disposable object pattern.
The npm package phosphor-disposable receives a total of 8 weekly downloads. As such, phosphor-disposable popularity was classified as not popular.
We found that phosphor-disposable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.