1.0.3 • Published 10 months ago

@jmnuf/wuonix v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

wuonix

Simple Signals

A relatively simple typescript library for creating signals. Signals are cool and this library is just for managing non-complexly built state in a relatively straight-forward fashion.

There is a base value signal for keeping track of a value and also you can get a computed signal derived from a base value signal that will get re-computed whenever the base value signal is updated.

Maybe in the future creating a computed signal based on multiple signals will be included, undecided as of now.

Usage:

import { createSignal } from "@jmnuf/wuonix";

const baseValue = "Hello, World!";
const baseText = createSignal(baseValue);
const lowercaseText = signal.computed((text) => text.toLowerCase());


console.log("baseText.value === baseValue ?", baseText.value === baseValue);
console.log("lowercaseText.value === baseValue.toLowerCase() ?", lowercaseText.value === baseValue.toLowerCase());

baseText.listen(({ prv, cur }) => {
  console.log("Value changed from", prv, "to", cur);
});

baseText(() => "Hi Mom!");

Develop

Install dependencies:

$ bun install

Build project:

$ bun run build

Run tests:

$ bun run tests

or

$ bun test

This project was created using bun init in bun v1.2.4. Bun is a fast all-in-one JavaScript runtime.

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

11 months ago