@@ -5,3 +5,3 @@ /** | ||
| * created by liushanbao <1262300490@qq.com> | ||
| * (c) 2020-05-05-2024-3-02 | ||
| * (c) 2020-05-05-2024-3-08 | ||
| * Released under the MIT License. | ||
@@ -181,2 +181,3 @@ */ | ||
| declare const createStore: <S extends PrimitiveState>(initialState?: InitialState<S> | undefined, options?: StoreOptions) => Store<S>; | ||
| /** | ||
@@ -205,2 +206,5 @@ * useStore api | ||
| /** | ||
| * @description Hook of subscribe | ||
| */ | ||
| declare const useSubscription: <S extends PrimitiveState>(store: S, listener: ListenerType<S>, stateKeys?: (keyof S)[] | undefined) => void; | ||
@@ -207,0 +211,0 @@ |
+6
-3
@@ -510,3 +510,5 @@ import { useEffect, useMemo, Component, PureComponent } from 'react'; | ||
| }; | ||
| // Hook of subscribe | ||
| /** | ||
| * @description Hook of subscribe | ||
| */ | ||
| const useSubscription = (store, listener, stateKeys) => { | ||
@@ -753,2 +755,3 @@ // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }; | ||
| /** | ||
@@ -855,3 +858,3 @@ * useStore api | ||
| [__CLASS_THIS_POINTER_STORES_KEY__] = new Set(); | ||
| // mock | ||
| // template code | ||
| connectStore(store) { return store; } | ||
@@ -883,3 +886,3 @@ } | ||
| [__CLASS_THIS_POINTER_STORES_KEY__] = new Set(); | ||
| // mock | ||
| // template code | ||
| connectStore(store) { return store; } | ||
@@ -886,0 +889,0 @@ } |
+6
-3
@@ -512,3 +512,5 @@ 'use strict'; | ||
| }; | ||
| // Hook of subscribe | ||
| /** | ||
| * @description Hook of subscribe | ||
| */ | ||
| const useSubscription = (store, listener, stateKeys) => { | ||
@@ -755,2 +757,3 @@ // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }; | ||
| /** | ||
@@ -857,3 +860,3 @@ * useStore api | ||
| [__CLASS_THIS_POINTER_STORES_KEY__] = new Set(); | ||
| // mock | ||
| // template code | ||
| connectStore(store) { return store; } | ||
@@ -885,3 +888,3 @@ } | ||
| [__CLASS_THIS_POINTER_STORES_KEY__] = new Set(); | ||
| // mock | ||
| // template code | ||
| connectStore(store) { return store; } | ||
@@ -888,0 +891,0 @@ } |
+5
-1
@@ -5,3 +5,3 @@ /** | ||
| * created by liushanbao <1262300490@qq.com> | ||
| * (c) 2020-05-05-2024-3-02 | ||
| * (c) 2020-05-05-2024-3-08 | ||
| * Released under the MIT License. | ||
@@ -181,2 +181,3 @@ */ | ||
| declare const createStore: <S extends PrimitiveState>(initialState?: InitialState<S> | undefined, options?: StoreOptions) => Store<S>; | ||
| /** | ||
@@ -205,2 +206,5 @@ * useStore api | ||
| /** | ||
| * @description Hook of subscribe | ||
| */ | ||
| declare const useSubscription: <S extends PrimitiveState>(store: S, listener: ListenerType<S>, stateKeys?: (keyof S)[] | undefined) => void; | ||
@@ -207,0 +211,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
| * created by liushanbao <1262300490@qq.com> | ||
| * (c) 2020-05-05-2024-3-02 | ||
| * (c) 2020-05-05-2024-3-08 | ||
| * Released under the MIT License. | ||
@@ -181,2 +181,3 @@ */ | ||
| declare const createStore: <S extends PrimitiveState>(initialState?: InitialState<S> | undefined, options?: StoreOptions) => Store<S>; | ||
| /** | ||
@@ -205,2 +206,5 @@ * useStore api | ||
| /** | ||
| * @description Hook of subscribe | ||
| */ | ||
| declare const useSubscription: <S extends PrimitiveState>(store: S, listener: ListenerType<S>, stateKeys?: (keyof S)[] | undefined) => void; | ||
@@ -207,0 +211,0 @@ |
@@ -522,3 +522,5 @@ System.register(['react', './platform', 'use-sync-external-store/shim'], (function (exports) { | ||
| }; | ||
| // Hook of subscribe | ||
| /** | ||
| * @description Hook of subscribe | ||
| */ | ||
| const useSubscription = exports('useSubscription', (store, listener, stateKeys) => { | ||
@@ -765,2 +767,3 @@ // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }); | ||
| /** | ||
@@ -867,3 +870,3 @@ * useStore api | ||
| [__CLASS_THIS_POINTER_STORES_KEY__] = new Set(); | ||
| // mock | ||
| // template code | ||
| connectStore(store) { return store; } | ||
@@ -895,3 +898,3 @@ } exports('ComponentWithStore', ComponentWithStore); | ||
| [__CLASS_THIS_POINTER_STORES_KEY__] = new Set(); | ||
| // mock | ||
| // template code | ||
| connectStore(store) { return store; } | ||
@@ -898,0 +901,0 @@ } exports('PureComponentWithStore', PureComponentWithStore); |
@@ -5,3 +5,3 @@ /** | ||
| * created by liushanbao <1262300490@qq.com> | ||
| * (c) 2020-05-05-2024-3-02 | ||
| * (c) 2020-05-05-2024-3-08 | ||
| * Released under the MIT License. | ||
@@ -181,2 +181,3 @@ */ | ||
| declare const createStore: <S extends PrimitiveState>(initialState?: InitialState<S> | undefined, options?: StoreOptions) => Store<S>; | ||
| /** | ||
@@ -205,2 +206,5 @@ * useStore api | ||
| /** | ||
| * @description Hook of subscribe | ||
| */ | ||
| declare const useSubscription: <S extends PrimitiveState>(store: S, listener: ListenerType<S>, stateKeys?: (keyof S)[] | undefined) => void; | ||
@@ -207,0 +211,0 @@ |
+6
-3
@@ -512,3 +512,5 @@ (function (global, factory) { | ||
| }; | ||
| // Hook of subscribe | ||
| /** | ||
| * @description Hook of subscribe | ||
| */ | ||
| const useSubscription = (store, listener, stateKeys) => { | ||
@@ -755,2 +757,3 @@ // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }; | ||
| /** | ||
@@ -857,3 +860,3 @@ * useStore api | ||
| [__CLASS_THIS_POINTER_STORES_KEY__] = new Set(); | ||
| // mock | ||
| // template code | ||
| connectStore(store) { return store; } | ||
@@ -885,3 +888,3 @@ } | ||
| [__CLASS_THIS_POINTER_STORES_KEY__] = new Set(); | ||
| // mock | ||
| // template code | ||
| connectStore(store) { return store; } | ||
@@ -888,0 +891,0 @@ } |
+3
-1
| { | ||
| "name": "resy", | ||
| "version": "11.0.0-rc.1", | ||
| "version": "11.0.0-rc.2", | ||
| "description": "React State Easy", | ||
@@ -143,2 +143,4 @@ "repository": "https://github.com/lsbFlying/resy.git", | ||
| "keywords": [ | ||
| "reactive", | ||
| "reactive-state", | ||
| "react", | ||
@@ -145,0 +147,0 @@ "hooks", |
+6
-12
@@ -307,3 +307,3 @@ <div align="center"> | ||
| {count} | ||
| <button onClick={() => { this.store.count++; }}>button +</button> | ||
| <button onClick={() => { store.count++; }}>button +</button> | ||
| </> | ||
@@ -315,2 +315,3 @@ ); | ||
| class PureAppClass extends PureComponentWithStore { | ||
| store = this.connectStore(store); | ||
@@ -323,3 +324,3 @@ | ||
| {count} | ||
| <button onClick={() => { this.store.count++; }}>button +</button> | ||
| <button onClick={() => { store.count++; }}>button +</button> | ||
| </> | ||
@@ -645,2 +646,3 @@ ); | ||
| class TextClass extends ComponentWithStore { | ||
| store = this.connectStore(store); | ||
@@ -658,2 +660,3 @@ | ||
| class CountClass extends ComponentWithStore { | ||
| store = this.connectStore(store); | ||
@@ -670,2 +673,3 @@ | ||
| class AppClass extends ComponentWithStore { | ||
| store = this.connectStore(store); | ||
@@ -876,7 +880,2 @@ | ||
| }) => { | ||
| /** | ||
| * effectState:Currently changing data | ||
| * nextState:Data after change | ||
| * prevState:Data before change | ||
| */ | ||
| console.log(effectState, prevState, nextState); | ||
@@ -908,7 +907,2 @@ }, ["count"]); | ||
| }) => { | ||
| /** | ||
| * effectState:Currently changing data | ||
| * nextState:Data after change | ||
| * prevState:Data before change | ||
| */ | ||
| console.log(effectState, prevState, nextState); | ||
@@ -915,0 +909,0 @@ }, ["count"]); |
300510
0.04%4669
0.43%999
-0.6%