Skip to content

peerreynders/fine-grained-reactivity-demo

Repository files navigation

Fine-Grained Reactivity Demo

A typed ECMAScript1 demo of fine-grained reactive programming.

$ cd fine-grained-reactivity-demo
$ npm i
added 411 packages from 225 contributors and audited 412 packages in 3.726s
found 0 vulnerabilities

$ npm run lint
> npm run lint:types && npm run lint:es
> cd ./reactivity && npm run lint:types
> ../node_modules/.bin/tsc
> eslint ./reactivity

$ npm run test
> cd ./reactivity && npm run test
> ../node_modules/.bin/ava --config ava.config.js
  ✔ A signal has a value
  ✔ A signal's value can be set
  ✔ A memo calculates an initial value
  ✔ A memo takes signals in the correct order
  ✔ A memo's value updates when it's signal is changed
  ✔ A memo can depend on other memos
  ✔ A memo fires an effect
  ✔ An effect fires only when the memo's value changes
  ✔ An effect does not report a stale value
  ✔ Effects can fire from distinct sources
  ✔ An effect fires even if the value it evaluates to doesn't change
  ✔ Effects can be added and removed
  ✔ Removing an effect multiple times doesn't interfere with other effects
  ✔ Effects should only be called once, even when multiple dependencies change
  ✔ Effect on a stable source doesn't fire - even when that source's sources vary


  15 tests passed
$

1: Originally authored in TypeScript. After this tweet this repository was converted to typed ECMAScript. For a somewhat simplified version in TypeScript see here. For a fundamental introduction please refer to Building a Reactive Library from Scratch (2021-02-18);

About

Typed ECMAScript demo of fine-grained reactive programming

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published