Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

@reactive-js/disposable

0.0.31 • Public • Published

@reactive-js/disposable

Utilities for managing the lifetimes of resources and composing their disposal semantics.

Installation

via npm

npm install @reactive-js/disposable

via yarn

yarn add @reactive-js/disposable

Usage

import { createDisposable } from "@reactive-js/disposable";
 
const arr = new Array(1000);
const onDispose = () => {
  arr.length = 0;
};
const disposable = createDisposable();
disposable.add(onDispose);
 
// ...sometime in the future
 
disposable.dispose();
// guaranteed that onDispose is only ever called once.

Documentation

API documentation is available here.

Install

npm i @reactive-js/disposable

DownloadsWeekly Downloads

166

Version

0.0.31

License

MIT

Unpacked Size

17.3 kB

Total Files

11

Last publish

Collaborators

  • avatar