fl0
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

fl0

An incremental computation library.

const count = fl0.var(0);
const stars = count.get().map(count => "*".repeat(count));

const countElm = document.querySelector("#count")!;
const inc = document.querySelector("#inc")!;
const dec = document.querySelector("#dec")!;

inc.addEventListener("click", () => {
  count.update((old: number) => old + 1);
});

dec.addEventListener("click", () => {
  count.update((old: number) => old - 1);
});

stars.observe((stars: string) => {
  countElm.textContent = stars;
});

Readme

Keywords

none

Package Sidebar

Install

npm i fl0

Weekly Downloads

1

Version

0.0.8

License

MIT

Unpacked Size

8.77 kB

Total Files

7

Last publish

Collaborators

  • frectonz