@justcoding123/signals
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

@justcoding123/signals

A signals library that does nothing too fancy.

Usage

import { Signal } from "@justcoding123/signals";

const [count, setCount] = Signal.createSignal(0);
const doubled = Signal.createMemo(() => count() * 2);

Signal.createEffect(({ defer }) => {
    console.log(`The count is: ${count()}`);
    defer(() => console.log("This gets called when effect is rerun, for cleaning up event listeners/etc..."));
});

setInterval(() => setCount(count() + 1), 500);

Readme

Keywords

none

Package Sidebar

Install

npm i @justcoding123/signals

Weekly Downloads

0

Version

0.0.4

License

ISC

Unpacked Size

5.32 kB

Total Files

4

Last publish

Collaborators

  • justcoding123