signal-effect
v0.0.5
Published
Simple effect() method based on the tc39/proposal-signals
Downloads
13
Readme
Signal Effect
Simple effect(() => {})
method based on the tc39/proposal-signals
Disclaimer: It uses "signal-polyfill" until the proposal is accepted and implemented in the browsers.
Install
npm install --save signal-effect signal-polyfill
Usage
// polyfill for signal
import { Signal } from 'signal-polyfill';
import { effect } from 'signal-effect';
const counter = new Signal.State(0);
effect(() => (element.innerText = counter.get()));
// Simulate external updates to counter...
setInterval(() => counter.set(counter.get() + 1), 1000);