proposal-signals / signal-polyfill

Implementation tracking the current state of https://github.com/tc39/proposal-signals
Apache License 2.0
217 stars 17 forks source link

Sginal should be polyfill to global #10

Open yinxulai opened 6 months ago

yinxulai commented 6 months ago

This package is named a "*-polyfill", but its behavior is quite different from other typical polyfills. Most polyfills register the target to the global or tagetprototype, such as:

promise-polyfill object.assign Array.prototype.map

We should consider whether this approach is appropriate, and whether the current implementation makes it difficult for multiple packages to share the same polyfill.

ljharb commented 6 months ago

I maintain the second two, and no, they do not automatically modify the global - quite intentionally, as that behavior is dangerous.

Providing an opt-in mechanism to do so would be great, though, although i hope it would wait until the proposal is at stage 3.

yinxulai commented 6 months ago

Providing an opt-in mechanism to do so would be grea

This is great, this allows me to call Signal in a more good way, what can I do to help we achieve this?