Skip to content

Commit 2bc8f85

Browse files
authored
UX Client Script Debug State (#1576)
* Create debug-state.js * Create readme.md
1 parent 63b56ba commit 2bc8f85

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @param {params} params
3+
* @param {api} params.api
4+
* @param {any} params.event
5+
* @param {any} params.imports
6+
* @param {ApiHelpers} params.helpers
7+
*/
8+
function handler({ api, event, helpers, imports }) {
9+
console.log(`DEBUG State:`, { ...api.state });
10+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Debug State UX Client Script
2+
3+
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.
4+
5+
## Features
6+
7+
- **Console Logging of State**: Logs the entire `state` object to the console, enabling developers to track and inspect state changes.
8+
- **Efficient Debugging**: Simplifies the debugging process by providing direct access to the client's state.
9+
10+
## Script Overview
11+
12+
```javascript
13+
/**
14+
* @param {params} params
15+
* @param {api} params.api
16+
* @param {any} params.event
17+
* @param {any} params.imports
18+
* @param {ApiHelpers} params.helpers
19+
*/
20+
function handler({ api, event, helpers, imports }) {
21+
console.log(`DEBUG State:`, { ...api.state });
22+
}
23+
```

0 commit comments

Comments
 (0)