simpler-state
Advanced tools
Comparing version 2.0.0-pre.7 to 2.0.0-rc.1
@@ -37,3 +37,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
function handleDevToolsEvent(event) { | ||
if (!isInspectorEnabled) return; | ||
if (!isInspectorEnabled || !devTools) return; | ||
@@ -68,2 +68,18 @@ if (event.type === 'DISPATCH') { | ||
case 'IMPORT_STATE': | ||
{ | ||
var _imported$computedSta; | ||
const { | ||
nextLiftedState: imported | ||
} = event.payload; | ||
if (!imported || !imported.computedStates) return; | ||
const currentIndex = imported.currentStateIndex ?? imported.computedStates.length - 1; | ||
const currentState = (_imported$computedSta = imported.computedStates[currentIndex]) == null ? void 0 : _imported$computedSta.state; | ||
if (typeof currentState !== 'object') return; | ||
updateRegistry(currentState); | ||
devTools.send(null, imported); | ||
return; | ||
} | ||
case 'PAUSE_RECORDING': | ||
@@ -85,3 +101,3 @@ isDevToolsPaused = !isDevToolsPaused; | ||
if (parsedState === undefined) return; | ||
if (typeof parsedState !== 'object') return; | ||
updateRegistry(parsedState); | ||
@@ -88,0 +104,0 @@ return parsedState; |
@@ -58,3 +58,3 @@ "use strict"; | ||
function handleDevToolsEvent(event) { | ||
if (!isInspectorEnabled) return; | ||
if (!isInspectorEnabled || !devTools) return; | ||
@@ -89,2 +89,16 @@ if (event.type === 'DISPATCH') { | ||
case 'IMPORT_STATE': | ||
{ | ||
var _imported$currentStat, _imported$computedSta; | ||
var imported = event.payload.nextLiftedState; | ||
if (!imported || !imported.computedStates) return; | ||
var currentIndex = (_imported$currentStat = imported.currentStateIndex) != null ? _imported$currentStat : imported.computedStates.length - 1; | ||
var currentState = (_imported$computedSta = imported.computedStates[currentIndex]) == null ? void 0 : _imported$computedSta.state; | ||
if (typeof currentState !== 'object') return; | ||
(0, _registry.updateRegistry)(currentState); | ||
devTools.send(null, imported); | ||
return; | ||
} | ||
case 'PAUSE_RECORDING': | ||
@@ -106,3 +120,3 @@ isDevToolsPaused = !isDevToolsPaused; | ||
if (parsedState === undefined) return; | ||
if (typeof parsedState !== 'object') return; | ||
(0, _registry.updateRegistry)(parsedState); | ||
@@ -109,0 +123,0 @@ return parsedState; |
{ | ||
"name": "simpler-state", | ||
"version": "2.0.0-pre.7", | ||
"version": "2.0.0-rc.1", | ||
"description": "The simplest app state management for React", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -7,2 +7,8 @@ import type { MutableMap } from './registry'; | ||
type: string; | ||
nextLiftedState?: { | ||
computedStates: { | ||
state: any; | ||
}[]; | ||
currentStateIndex?: number; | ||
}; | ||
[P: string]: any; | ||
@@ -19,3 +25,3 @@ }; | ||
type: string; | ||
}, state: MutableMap): void; | ||
} | null, state: MutableMap): void; | ||
subscribe(callback: (event: DevToolsEvent) => void): void; | ||
@@ -22,0 +28,0 @@ } |
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
39994
936