1.9.1 • Published 2 years ago

solid-signals v1.9.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Solid Signals

Composable signals for SolidJS

All composable signals will extend the base SolidJS signal API by adding properties to accessors and setters, all fully typed.

Installation

$ npm install solid-signals

Usage

Basic

This example uses createHistory, see other signals in the Signals section

const [state, setState] = createHistory(0);

state(); // => 0
// Accessor extension
state.history(); // => [0]

setState(1);
state(); // => 1
state.history(); // => [0, 1]

// Setter extension
setState.history.back();
state(); // => 0
state.history(); // => [0]

setState.history.forward();
state(); // => 1
state.history(); // => [0, 1]

Composition

Signal composition is achieved by wrapping other signals with the .wrap method. This allows you to extend a signal with as many features as you'd like instead of using a single feature set provided by a traditional signal.

import { createArray, createHistory } from "solid-signals";

const [state, setState] = createHistory.wrap(createArray<number>([]));

// setState.push is provided by createArray
setState.push(1); // state() => [1]
setState.push(1, 2, 3); // state() => [1, 2, 3]

// setState.history.back is provided by createHistory
setState.history.back(); // state() => [1]

// Accessors can also be extended
// state.history is provided by createHistory
state.history(); // => [[], [1]]

Signals

Creating your own composable signal

(This api is not finalized)

You can create your own composable signal by using the signalExtender api, see createObject.ts for an example

1.9.1

2 years ago

1.9.0

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.7.0

2 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.2.6

3 years ago

1.6.1

3 years ago

1.4.3

3 years ago

1.2.5

3 years ago

1.6.0

3 years ago

1.4.2

3 years ago

1.2.4

3 years ago

1.4.1

3 years ago

1.2.3

3 years ago

1.4.0

3 years ago

1.2.2

3 years ago

1.3.10

3 years ago

1.3.9

3 years ago

1.3.8

3 years ago

1.5.5

3 years ago

1.3.7

3 years ago

1.5.4

3 years ago

1.3.6

3 years ago

1.5.3

3 years ago

1.3.5

3 years ago

1.5.2

3 years ago

1.3.4

3 years ago

1.5.1

3 years ago

1.3.3

3 years ago

1.5.0

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

1.0.0

3 years ago