-
Notifications
You must be signed in to change notification settings - Fork 4
Add recho.state(value) #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Deploying recho with
|
| Latest commit: |
dcd1c0b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fb16d009.recho.pages.dev |
| Branch Preview URL: | https://mutable.recho.pages.dev |
3f305c5 to
9edb43c
Compare
5c9c667 to
5dbb7e0
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new state function to the standard library that provides React-like state management capabilities. The implementation is derived from Observable Notebook Kit's mutable and observe utilities.
- Implements a
state()function that returns a tuple of[state, setState, getState]for reactive state management - Adds the
observegenerator utility to support reactive value updates - Includes test coverage for the new functionality
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| runtime/stdlib/state.js | Implements the state() function and internal Mutable helper using the observe generator |
| runtime/stdlib/observe.js | Adds async generator for reactive value observation with initialization and disposal lifecycle |
| runtime/stdlib/index.js | Exports the new state function from the stdlib module |
| test/stdlib.spec.js | Adds test assertion to verify state is exported from stdlib |
| test/js/mutable.js | Adds test case demonstrating state usage with setter callbacks |
| test/js/index.js | Exports the new mutable test case |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Here is a basic example for
recho.state(value):This feature is useful for interactive data structure visualization.