Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 2.27 KB

README.md

File metadata and controls

36 lines (28 loc) · 2.27 KB

Docs Build Status npm-version Coverage Status minified-size

Enhance value with plain and explicit reactive wrapper. Think of it as hook-style signals.

Legacy versions: v5

Features

  • Plain reactivity.
    Without the implicit-cast Proxy magic like Vue Reactivity and MobX.
  • Single-layer shallow reactivity.
    It does not convert the value with Object.defineProperty nor Proxy. Keeping everything as plain JavaScript value makes it easier to work with other libraries and easier for the JavaScript engine to optimize.
  • Safe and fast lazy computation.
    It solves multi-level derivation issue (like in Svelte Stores) with smart lazy value evaluation.
  • Weak side effects.
    Vals are managed with FinalizationRegistry and WeakRef which means you can create and access derived Val.value without worrying about memory leaks. Disposers returned by subscriptions can also be easily managed with libraries like @wopjs/disposable.
  • Explicit.
    Reactive objects are easy to tell since their types are different from normal objects. Subscription also requires explicit dependency declaration which reduce the work of repetitive dynamic dependency collection in Proxy/Signal implementations.
  • Simple DX.
    Designed with ergonomics in mind. No hidden rules for getting or setting values. What you see is what you get.

Install

npm add value-enhancer