valoo-yarn-fix
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

🐻 valoo

just the bare necessities of state management.

Usage

Hotlink it from https://unpkg.com/valoo.

See Interactive Codepen Demo.

import valoo from 'https://unpkg.com/valoo'

// create an observable value:
const num = valoo(42)

// subscribe to value changes:
const off = num.on( v => console.log(v) )

// unsubscribe that listener:
off()

// set the value, invoking any listeners:
num(43)

// get the current value:
num()  // 43

Other Versions

  • valoo-lite.mjs: lighter 120b version, but doesn't support unsubscribing.
  • valoo-original.mjs: v1-compatible, with subscribe handled via overloading.

Credit

The idea here was first implemented in Mithril. I believe the subscription mechanism is new though.

License

Apache-2.0. Copyright 2018 Google LLC.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.1.114latest

Version History

VersionDownloads (Last 7 Days)Published
2.1.114
2.1.00

Package Sidebar

Install

npm i valoo-yarn-fix

Weekly Downloads

12

Version

2.1.1

License

Apache-2.0

Unpacked Size

4.99 kB

Total Files

12

Last publish

Collaborators

  • pofider