Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Latest commit

 

History

History
110 lines (79 loc) · 3.08 KB

README.md

File metadata and controls

110 lines (79 loc) · 3.08 KB

rx-cancellable

Reactive Extensions - represents a state of cancellation

NPM

HitCount

Platform Build Status
Linux Build Status
Windows Build 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:

Type Description
BooleanCancellable Basic implementation of a Cancellable that represents a boolean state.
CompositeCancellable An implementation of a Cancellable that allows composition of multiple Cancellable instances into a single Cancellable instance.
LinkedCancellable A Cancellable whose state relies upon another Cancellable. If a LinkedCancellable has no link, it is treated as a BooleanCancellable.

And provides 2 Singleton instance:

Type Description
CANCELLED A Cancellable instance that is always cancelled.
UNCANCELLED A 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