react-dynamic-help
Advanced tools
Comparing version 2.1.5 to 2.1.6
@@ -28,2 +28,3 @@ import * as React from "react"; | ||
systemState: SystemState; | ||
prevUserState: string; | ||
propagateSystemState: () => void; | ||
@@ -30,0 +31,0 @@ constructor(props: HelpControllerProps); |
@@ -103,6 +103,11 @@ "use strict"; | ||
this.systemState = Object.assign({}, __resetState); | ||
this.prevUserState = ""; | ||
this.propagateSystemState = () => { | ||
(0, DynamicHelp_1.log)(this.props.debug, "HelpController state update:", this.systemState); | ||
const stringified = JSON.stringify(this.systemState.userState); | ||
this.props.storage.saveState(stringified); | ||
// a simplistic check to reduce writes to system storage | ||
if (stringified !== this.prevUserState) { | ||
this.props.storage.saveState(stringified); | ||
this.prevUserState = stringified; | ||
} | ||
this.setState({ systemState: this.systemState }); | ||
@@ -200,3 +205,2 @@ }; | ||
this.enableHelp = (enabled = true) => { | ||
console.log("Enable help", enabled); | ||
if (enabled) { | ||
@@ -203,0 +207,0 @@ this.reloadUserState(); |
@@ -28,2 +28,3 @@ import * as React from "react"; | ||
systemState: SystemState; | ||
prevUserState: string; | ||
propagateSystemState: () => void; | ||
@@ -30,0 +31,0 @@ constructor(props: HelpControllerProps); |
@@ -77,6 +77,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; | ||
this.systemState = Object.assign({}, __resetState); | ||
this.prevUserState = ""; | ||
this.propagateSystemState = () => { | ||
log(this.props.debug, "HelpController state update:", this.systemState); | ||
const stringified = JSON.stringify(this.systemState.userState); | ||
this.props.storage.saveState(stringified); | ||
// a simplistic check to reduce writes to system storage | ||
if (stringified !== this.prevUserState) { | ||
this.props.storage.saveState(stringified); | ||
this.prevUserState = stringified; | ||
} | ||
this.setState({ systemState: this.systemState }); | ||
@@ -174,3 +179,2 @@ }; | ||
this.enableHelp = (enabled = true) => { | ||
console.log("Enable help", enabled); | ||
if (enabled) { | ||
@@ -177,0 +181,0 @@ this.reloadUserState(); |
{ | ||
"name": "react-dynamic-help", | ||
"description": "React Dynamic Help - Create flows of helpful popups in your React App", | ||
"version": "2.1.5", | ||
"version": "2.1.6", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -10,3 +10,3 @@ # react-dynamic-help | ||
V 2.1.5 - As integrated with [online-go.com](https://online-go.com). | ||
V 2.1.6 - As integrated with [online-go.com](https://online-go.com). | ||
@@ -13,0 +13,0 @@ Demo at https://github.com/GreenAsJade/react-dynamic-help-demo |
118674
2553