little-state-machine
Advanced tools
Comparing version 2.3.2 to 2.3.3
import * as React from 'react'; | ||
declare let setStorageName: any; | ||
export declare function setStorageType(type: any): void; | ||
declare const setStorageName: (name: any) => void; | ||
export declare function createStore(data: any): void; | ||
export { setStorageName }; | ||
export declare function createStore(data: any): void; | ||
export declare const StateMachineContext: React.Context<{ | ||
@@ -7,0 +7,0 @@ store: {}; |
@@ -6,2 +6,6 @@ import * as React from 'react'; | ||
let storageType = window.sessionStorage; | ||
let get; | ||
let set; | ||
let getName; | ||
let setStorageName; | ||
const STATE_MACHINE_DEBUG_NAME = '__STATE_MACHINE_DEBUG__'; | ||
@@ -32,4 +36,8 @@ function setStorageType(type) { | ||
} | ||
const { setName: setStorageName, getName, get, set } = storeFactory(); | ||
function createStore(data) { | ||
const factoryResult = storeFactory(); | ||
setStorageName = factoryResult.setName; | ||
getName = factoryResult.getName; | ||
get = factoryResult.get; | ||
set = factoryResult.set; | ||
const result = get(); | ||
@@ -90,3 +98,9 @@ if (result && Object.keys(result).length) | ||
? Object.entries(callbacks).reduce((previous, [key, callback]) => { | ||
previous[key] = actionTemplate({ options, callback, updateStore, globalState, key }); | ||
previous[key] = actionTemplate({ | ||
options, | ||
callback, | ||
updateStore, | ||
globalState, | ||
key, | ||
}); | ||
return previous; | ||
@@ -101,3 +115,10 @@ }, {}) | ||
actions: {}, | ||
action: callbacks ? actionTemplate({ options, callback: callbacks, updateStore, globalState }) : () => { }, | ||
action: callbacks | ||
? actionTemplate({ | ||
options, | ||
callback: callbacks, | ||
updateStore, | ||
globalState, | ||
}) | ||
: () => { }, | ||
state: globalState, | ||
@@ -104,0 +125,0 @@ }; |
@@ -9,2 +9,6 @@ 'use strict'; | ||
let storageType = window.sessionStorage; | ||
let get; | ||
let set; | ||
let getName; | ||
const STATE_MACHINE_DEBUG_NAME = '__STATE_MACHINE_DEBUG__'; | ||
@@ -35,4 +39,8 @@ function setStorageType(type) { | ||
} | ||
const { setName: setStorageName, getName, get, set } = storeFactory(); | ||
function createStore(data) { | ||
const factoryResult = storeFactory(); | ||
exports.setStorageName = factoryResult.setName; | ||
getName = factoryResult.getName; | ||
get = factoryResult.get; | ||
set = factoryResult.set; | ||
const result = get(); | ||
@@ -93,3 +101,9 @@ if (result && Object.keys(result).length) | ||
? Object.entries(callbacks).reduce((previous, [key, callback]) => { | ||
previous[key] = actionTemplate({ options, callback, updateStore, globalState, key }); | ||
previous[key] = actionTemplate({ | ||
options, | ||
callback, | ||
updateStore, | ||
globalState, | ||
key, | ||
}); | ||
return previous; | ||
@@ -104,3 +118,10 @@ }, {}) | ||
actions: {}, | ||
action: callbacks ? actionTemplate({ options, callback: callbacks, updateStore, globalState }) : () => { }, | ||
action: callbacks | ||
? actionTemplate({ | ||
options, | ||
callback: callbacks, | ||
updateStore, | ||
globalState, | ||
}) | ||
: () => { }, | ||
state: globalState, | ||
@@ -113,4 +134,3 @@ }; | ||
exports.createStore = createStore; | ||
exports.setStorageName = setStorageName; | ||
exports.setStorageType = setStorageType; | ||
exports.useStateMachine = useStateMachine; |
{ | ||
"name": "little-state-machine", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.es.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
181640
313