From 2bc8f851ffeaf6b7fdcc4debcb0930f3c9fd6662 Mon Sep 17 00:00:00 2001 From: Reece Poulsen <147538373+yansa-reece@users.noreply.github.com> Date: Thu, 31 Oct 2024 01:18:57 -0600 Subject: [PATCH] UX Client Script Debug State (#1576) * Create debug-state.js * Create readme.md --- UX Client Scripts/debug-state/debug-state.js | 10 +++++++++ UX Client Scripts/debug-state/readme.md | 23 ++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 UX Client Scripts/debug-state/debug-state.js create mode 100644 UX Client Scripts/debug-state/readme.md diff --git a/UX Client Scripts/debug-state/debug-state.js b/UX Client Scripts/debug-state/debug-state.js new file mode 100644 index 0000000000..aaca8488e4 --- /dev/null +++ b/UX Client Scripts/debug-state/debug-state.js @@ -0,0 +1,10 @@ +/** +* @param {params} params +* @param {api} params.api +* @param {any} params.event +* @param {any} params.imports +* @param {ApiHelpers} params.helpers +*/ +function handler({ api, event, helpers, imports }) { + console.log(`DEBUG State:`, { ...api.state }); +} diff --git a/UX Client Scripts/debug-state/readme.md b/UX Client Scripts/debug-state/readme.md new file mode 100644 index 0000000000..2607a2f84e --- /dev/null +++ b/UX Client Scripts/debug-state/readme.md @@ -0,0 +1,23 @@ +# Debug State UX Client Script + +This repository contains a UX Client Script called `Debug State`, designed to log the current client state to the console. This script is useful for developers who want to inspect the state object in real time, making debugging more efficient by allowing quick access to current state values. + +## Features + +- **Console Logging of State**: Logs the entire `state` object to the console, enabling developers to track and inspect state changes. +- **Efficient Debugging**: Simplifies the debugging process by providing direct access to the client's state. + +## Script Overview + +```javascript +/** + * @param {params} params + * @param {api} params.api + * @param {any} params.event + * @param {any} params.imports + * @param {ApiHelpers} params.helpers + */ +function handler({ api, event, helpers, imports }) { + console.log(`DEBUG State:`, { ...api.state }); +} +```