0.3.2 • Published 5 years ago

rx-cancellable v0.3.2

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

rx-cancellable

Reactive Extensions - represents a state of cancellation

NPM

npm.io HitCount

PlatformBuild Status
LinuxBuild Status
WindowsBuild status

codecov Known Vulnerabilities

Install

NPM

npm i rx-cancellable

CDN

  • jsDelivr
<script src="https://cdn.jsdelivr.net/npm/rx-cancellable/dist/index.min.js"></script>
  • unpkg
<script src="https://unpkg.com/rx-cancellable/dist/index.min.js"></script>

Usage

Loading the module

CommonJS

const {
  Cancellable,
  CANCELLED,
  UNCANCELLED,
  BooleanCancellable,
  CompositeCancellable,
  LinkedCancellable
} = require('rx-cancellable');

Browser

Loading the JavaScript file for the rx-cancellable the classes:

  • Cancellable
  • CANCELLED,
  • UNCANCELLED,
  • BooleanCancellable,
  • CompositeCancellable,
  • LinkedCancellable

Types

There are 3 types of Cancellables provided:

TypeDescription
BooleanCancellableBasic implementation of a Cancellable that represents a boolean state.
CompositeCancellableAn implementation of a Cancellable that allows composition of multiple Cancellable instances into a single Cancellable instance.
LinkedCancellableA Cancellable whose state relies upon another Cancellable. If a LinkedCancellable has no link, it is treated as a BooleanCancellable.

And provides 2 Singleton instance:

TypeDescription
CANCELLEDA Cancellable instance that is always cancelled.
UNCANCELLEDA Cancellable instance that is always uncancelled.

Documentation

You can read the documentation at the official doc site

Build

Clone the repo first, then run the following to install the dependencies

npm install

To build the coverages, run the test suite, the docs, and the distributable modules:

npm run build

Changelogs

0.3.2

  • Fixed CompositeCancellable not dispatching event listeners when cancelled. 0.3.0
  • Removed privacy of cancellable states. The decision of replacement is due to performance issues with WeakMaps. 0.2.0
  • Introduces 3 Cancellable classes instead of a tree-structured Cancellable.
  • Introduces 2 singleton instances of Cancellable 0.1.0
  • Release