1.0.7-experimental • Published 1 year ago

signalify-store v1.0.7-experimental

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

signals-store

npm version

A simple store for Preact using Signals.

Install

npm install signalify-store

Usage

import { createStore } from "signalify-store";
// create a store with a default value
const store = createStore({ count: 0 });

// get the value of the store
const count = store((state) => state.count);

// subscribe to the store
count.subscribe((count) => {
	console.log("count", count);
    // => 0
});

// update the store
count.value++;
// => count 1

Persist

const store = createStore(
	{ count: 0 },
	{
		persist: {
			name: "my-app",
			storage: window.localStorage // or window.sessionStorage or window.caches or any other instance of Storage
		},
	},
);

Create a store with the given data and options.

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago