Skip to main content

A small Parity JavaScript library providing reactive expressions, so called `Bond`s. Classes deriving from `Bond` are expected to determine when their value has changed and call `trigger` accordingly.

A small Parity JavaScript library providing reactive expressions, so called Bonds. Classes deriving from Bond are expected to determine when their value has changed and call trigger accordingly. TimeBond is provided as a simple expression type which evaluates to the current time and triggers an update once per second.

Expressions can be composed through TransformBond, which allows both argument dependencies (that get passed into the combination transform) and non-argument dependencies (which do not). For its dependencies, TransformBond is able to work with basic values, Promises and other Bonds abstractly.

Installation

npm install oo7 --save

Usage

var oo7 = require('oo7'),
  Bond = oo7.Bond,
  TimeBond = oo7.TimeBond,
  TransformBond = oo7.TransformBond;

let t = new TimeBond;

// Prints the Unix time every second.
t.subscribe(console.log);

// Prints the formatted date every second.
new TransformBond(x => new Date(x), [t]).subscribe(console.log);

Tests

npm test