extra-react-hooks 0.1.8 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/es2015/index.min.mjs +18 -3
- package/dist/es2015/index.min.mjs.map +1 -1
- package/dist/es2015/index.mjs +16355 -344
- package/dist/es2015/index.mjs.map +1 -1
- package/dist/es2015/index.umd.js +16355 -343
- package/dist/es2015/index.umd.js.map +1 -1
- package/dist/es2015/index.umd.min.js +18 -3
- package/dist/es2015/index.umd.min.js.map +1 -1
- package/dist/es2018/index.min.mjs +18 -3
- package/dist/es2018/index.min.mjs.map +1 -1
- package/dist/es2018/index.mjs +16355 -344
- package/dist/es2018/index.mjs.map +1 -1
- package/dist/es2018/index.umd.js +16355 -343
- package/dist/es2018/index.umd.js.map +1 -1
- package/dist/es2018/index.umd.min.js +18 -3
- package/dist/es2018/index.umd.min.js.map +1 -1
- package/lib/es2015/index.d.ts +1 -0
- package/lib/es2015/index.js +6 -1
- package/lib/es2015/index.js.map +1 -1
- package/lib/es2015/use-finite-state-machine.d.ts +3 -0
- package/lib/es2015/use-finite-state-machine.js +17 -0
- package/lib/es2015/use-finite-state-machine.js.map +1 -0
- package/lib/es2018/index.d.ts +1 -0
- package/lib/es2018/index.js +6 -1
- package/lib/es2018/index.js.map +1 -1
- package/lib/es2018/use-finite-state-machine.d.ts +3 -0
- package/lib/es2018/use-finite-state-machine.js +17 -0
- package/lib/es2018/use-finite-state-machine.js.map +1 -0
- package/package.json +27 -23
- package/CHANGELOG.md +0 -61
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# extra-react-hooks
|
|
2
|
-
|
|
3
2
|
## Install
|
|
4
|
-
|
|
5
3
|
```sh
|
|
6
4
|
npm install --save extra-react-hooks
|
|
7
5
|
# or
|
|
@@ -9,15 +7,12 @@ yarn add extra-react-hooks
|
|
|
9
7
|
```
|
|
10
8
|
|
|
11
9
|
## API
|
|
12
|
-
|
|
13
10
|
### useToggle
|
|
14
|
-
|
|
15
11
|
```ts
|
|
16
12
|
function useToggle(initialState: boolean = false): [on: boolean, toggle: () => void]
|
|
17
13
|
```
|
|
18
14
|
|
|
19
15
|
### useSingleSelection
|
|
20
|
-
|
|
21
16
|
```ts
|
|
22
17
|
interface IOption<T> {
|
|
23
18
|
value: T
|
|
@@ -37,13 +32,11 @@ function useSingleSelection<T>(values: T[]): {
|
|
|
37
32
|
```
|
|
38
33
|
|
|
39
34
|
### useMount
|
|
40
|
-
|
|
41
35
|
```ts
|
|
42
36
|
function useMount(effect: EffectCallback): void
|
|
43
37
|
```
|
|
44
38
|
|
|
45
39
|
### useStateCycle
|
|
46
|
-
|
|
47
40
|
```ts
|
|
48
41
|
function useStateCycle<T>(
|
|
49
42
|
stateList: [T, ...T[]]
|
|
@@ -52,13 +45,11 @@ function useStateCycle<T>(
|
|
|
52
45
|
```
|
|
53
46
|
|
|
54
47
|
### useIsMounted
|
|
55
|
-
|
|
56
48
|
```ts
|
|
57
49
|
function useIsMounted(): () => boolean
|
|
58
50
|
```
|
|
59
51
|
|
|
60
52
|
### useIncrement
|
|
61
|
-
|
|
62
53
|
```ts
|
|
63
54
|
function useIncrement(
|
|
64
55
|
initialValue: number
|
|
@@ -66,7 +57,6 @@ function useIncrement(
|
|
|
66
57
|
```
|
|
67
58
|
|
|
68
59
|
### useResizeObserver
|
|
69
|
-
|
|
70
60
|
```ts
|
|
71
61
|
function useResizeObserver(
|
|
72
62
|
callback: ResizeObserverCallback
|
|
@@ -75,7 +65,6 @@ function useResizeObserver(
|
|
|
75
65
|
```
|
|
76
66
|
|
|
77
67
|
### useStep
|
|
78
|
-
|
|
79
68
|
```ts
|
|
80
69
|
function useStep<T>(
|
|
81
70
|
steps: [T, ...T[]]
|
|
@@ -84,7 +73,18 @@ function useStep<T>(
|
|
|
84
73
|
```
|
|
85
74
|
|
|
86
75
|
### useForceUpdate
|
|
87
|
-
|
|
88
76
|
```ts
|
|
89
77
|
function useForceUpdate(): () => void
|
|
90
78
|
```
|
|
79
|
+
|
|
80
|
+
### useFiniteStateMachine
|
|
81
|
+
```ts
|
|
82
|
+
function useFiniteStateMachine<State extends string, Event extends string>(
|
|
83
|
+
schema: IFiniteStateMachineSchema<State, Event>
|
|
84
|
+
, initialState: State
|
|
85
|
+
): ObservableFiniteStateMachine<State, Event>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The `ObservableFiniteStateMachine` comes from [@blackglory/structures].
|
|
89
|
+
|
|
90
|
+
[@blackglory/structures]: https://www.npmjs.com/package/@blackglory/structures
|