Skip to content

Commit

Permalink
UX Client Script Debug State (#1576)
Browse files Browse the repository at this point in the history
* Create debug-state.js

* Create readme.md
  • Loading branch information
yansa-reece authored Oct 31, 2024
1 parent 63b56ba commit 2bc8f85
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
10 changes: 10 additions & 0 deletions UX Client Scripts/debug-state/debug-state.js
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 });
}
23 changes: 23 additions & 0 deletions UX Client Scripts/debug-state/readme.md
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 });
}
```

0 comments on commit 2bc8f85

Please sign in to comment.