-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UX Client Script Debug State (#1576)
* Create debug-state.js * Create readme.md
- Loading branch information
1 parent
63b56ba
commit 2bc8f85
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }); | ||
} | ||
``` |