Skip to content
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

We need your help to develop Signals! #95

Open
littledan opened this issue Apr 1, 2024 · 5 comments
Open

We need your help to develop Signals! #95

littledan opened this issue Apr 1, 2024 · 5 comments
Labels
good first issue Good for newcomers

Comments

@littledan
Copy link
Member

littledan commented Apr 1, 2024

There's a lot that you all can do to help, including:

  • Try out signals within your framework or application
  • Improve the documentation/learning materials for signals
  • Document use cases (whether it's something the API supports well or not)
  • Write more tests, e.g., by porting them from other signal implementations Add more tests for signals #70
  • Port other signal implementations to this API
  • Write benchmarks for signals, both synthetic and real-world application ones Benchmarks for signal implementations  #71
  • File issues on polyfill bugs, your design thoughts, etc.
  • Development reactive data structures/state management abstractions on top of signals
  • Implement signals natively in a JS engine (behind a flag/in a PR, not shipped!)
@littledan littledan added the good first issue Good for newcomers label Apr 1, 2024
@littledan littledan pinned this issue Apr 1, 2024
@NullVoxPopuli
Copy link
Collaborator

NullVoxPopuli commented Apr 1, 2024

I'm making a utility library here: https://github.com/NullVoxPopuli/signal-utils

The implementations and tests are going to be ports from other ecosystems 🎉
I can also use this repo's tests to see how changes to the polyfill over time affect things!

Current structures / utils:

  • SignalArray
  • SignalObject
  • SignalMap
  • SignalWeakMap
  • SignalSet
  • SignalWeakSet
  • SignalAsyncData / load -- provides reactive signal-states for the phases and results of a promise
  • signalFunction -- reactive automatic and lazy async function invocation
  • localCopy -- fork remote state
  • @signal turn any property on a class into a transparent Signal.State
  • @cached turn any getter on a class into a transparent Signal.Computed
  • @localCopy alternate way to fork remote state in classes -- idk what's better

@quantuminformation
Copy link

@ed-puckett
Copy link

ed-puckett commented Apr 16, 2024

I'm failing to get the example code shown in the readme to work (section: "Using signals"). This is the counter/isEven/parity example, and I am using the effect.js implementation shown there, too (section "Creating a simple effect"). I'm using node 21.7.3.

The problem is that the effect() callback is never run (except for the initial time). What am I doing wrong?

Note: I added a console.log() to the setInterval callback to make sure it is being called and, yes, it is, but no corresponding output from the effect() callback.

Note: I get the same behavior when using the signal-polyfill package from npm, or when directly using the polyfill built from this repository's packages/signal-polyfill subdirectory.

PS very excited about this, and looking forward to getting it to work!


UPDATE:
I got this to work after changing the given example code for effect.js:

  1. changed initialization of needsEnqueue from false to true
  2. changed queueMicrotask.enqueue(...) to queueMicrotask(...)

Would it be possible to update the readme example?

@NullVoxPopuli
Copy link
Collaborator

Would it be possible to update the readme example?

of course!
would you like to submit a PR?
We also have a working example of the microtaskqueue effect here: https://github.com/proposal-signals/signal-utils/blob/main/src/subtle/microtask-effect.ts

@yinxulai

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants