1.0.4 • Published 10 months ago

signus v1.0.4

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

Signus

Framework agnostic signals.

Installation

> npm install signus
> yarn add signus
> pnpm add signus

Usage

You must create a SignalManager instance and use it to create signals.

Example

import { SignalManager } from "signus";

const signalManager = new SignalManager();
const signal = signalManager.createSignal("mySignal");
signal.subscribe((value) => console.log(value));
signal.emit("Hello world");

Reuse a signal

If you want to reuse a signal, you can get it from the SignalManager instance.

import signalManager from "./signalManager";

const signal = signalManager.getSignal("mySignal");
signal.subscribe((value) => console.log(value));

Remove a signal from the manager

You can remove a signal from the manager by calling the removeSignal method.

signalManager.removeSignal("mySignal");

Remove a listener from a signal

You can remove a listener from a signal by calling the unsubscribe method.

signal.unsubscribe();

License

MIT

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago