react-app-store-manager 1.4.16 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Provider.d.ts +1 -1
- package/dist/Provider.js +2 -2
- package/dist/Store.d.ts +3 -8
- package/dist/createStore.d.ts +1 -1
- package/dist/createStore.js +1 -1
- package/package.json +1 -1
package/dist/Provider.d.ts
CHANGED
package/dist/Provider.js
CHANGED
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
exports.__esModule = true;
|
26
26
|
exports.Provider = void 0;
|
27
27
|
var react_1 = __importStar(require("react"));
|
28
|
-
|
28
|
+
function Provider(_a) {
|
29
29
|
var store = _a.store, children = _a.children;
|
30
30
|
var Provider = store.context;
|
31
31
|
var _b = (0, react_1.useReducer)(function (x) { return !x; }, true), updater = _b[0], forceUpdate = _b[1];
|
@@ -40,5 +40,5 @@ var Provider = function (_a) {
|
|
40
40
|
return function () { return store.unsubscribe(listener); };
|
41
41
|
}, [store]);
|
42
42
|
return (react_1["default"].createElement(Provider.Provider, { value: value }, children));
|
43
|
-
}
|
43
|
+
}
|
44
44
|
exports.Provider = Provider;
|
package/dist/Store.d.ts
CHANGED
@@ -2,14 +2,9 @@ import React, { Context } from "react";
|
|
2
2
|
interface ListenerInterface {
|
3
3
|
onUpdate(): void;
|
4
4
|
}
|
5
|
-
export interface ActionsInterface {
|
6
|
-
[action: string]: (payload: any) => any;
|
7
|
-
}
|
8
5
|
export interface StoreInterface<Value, Action> {
|
9
6
|
context: Context<Value>;
|
10
7
|
value: Value;
|
11
|
-
actions: ActionsInterface;
|
12
|
-
listeners: ListenerInterface[];
|
13
8
|
update(store: (store: Value) => Value): void;
|
14
9
|
action(actions: (action: Action) => any): void;
|
15
10
|
subscribe(listener: ListenerInterface): void;
|
@@ -18,9 +13,9 @@ export interface StoreInterface<Value, Action> {
|
|
18
13
|
export declare class Store<Value, Action> implements StoreInterface<Value, Action> {
|
19
14
|
context: React.Context<Value>;
|
20
15
|
value: Value;
|
21
|
-
actions
|
22
|
-
listeners
|
23
|
-
constructor(value: Value, actions
|
16
|
+
private readonly actions?;
|
17
|
+
private listeners;
|
18
|
+
constructor(value: Value, actions?: Action);
|
24
19
|
update(callback: any): void;
|
25
20
|
action(callback: any): void;
|
26
21
|
subscribe(listener: ListenerInterface): void;
|
package/dist/createStore.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
import { StoreInterface } from "./Store";
|
2
|
-
export declare function createStore<Value
|
2
|
+
export declare function createStore<Value>(value: any, actions?: any): StoreInterface<Value, typeof actions>;
|
package/dist/createStore.js
CHANGED
@@ -3,6 +3,6 @@ exports.__esModule = true;
|
|
3
3
|
exports.createStore = void 0;
|
4
4
|
var Store_1 = require("./Store");
|
5
5
|
function createStore(value, actions) {
|
6
|
-
return new Store_1.Store(value, actions
|
6
|
+
return new Store_1.Store(value, actions);
|
7
7
|
}
|
8
8
|
exports.createStore = createStore;
|