-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add observeReadyElements
method
#36
Add observeReadyElements
method
#36
Conversation
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Wouldn't it be better to use something more platform native and general like async iterable? |
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Yes it would - changed the code. |
Instead of using |
Co-authored-by: Sindre Sorhus <[email protected]>
Co-authored-by: Sindre Sorhus <[email protected]>
Indeed. Looks like as well as a |
Would be nice to have a test for |
As far as I can tell, there is no way to test if |
A test would at least confirm that it correctly stops and resolves with the correct items. |
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
CI is failing because of sindresorhus/p-state#6 |
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
Signed-off-by: Richie Bendall <[email protected]>
…element-ready into observe-ready-elements
Signed-off-by: Richie Bendall <[email protected]>
Regarding #36 (comment). I disagree with your reasoning. The performance difference in real-world scenarios is negligible. But I also don't feel strongly about it and this PR has had enough back-and-forth, so I'm going to leave it. |
observeReadyElements
observeReadyElements
method
Thanks for contributing this :) |
Depends on sindresorhus/type-fest#246I was unable to useany-observable
for these reasons:If I import it at the top level, the user will be forced to install an observable library even if they don't need it.If I import it within the function, I will have to use theimport
function which will force me to make the observable-returning function a observable-resolving-promise-returning function which would not be user-friendly and a bit annoying to implement.If I try to useimport
at the top-level in a try/catch block, I will need to require Node.js 14.8. ESLint also has trouble parsing this and making it work is quite inconvenient. Enable Top Level Await eslint/eslint#13178any-observable
doesn't use ESM and the interop layer Node.js uses doesn't seem to allowimport 'any-observable/register/zen';
to actually register the observer. ESM any-observable#27When running the unit tests locally, a test for a different part of code that this PR does not change failed:element-ready/test.js
Line 212 in 32360a0
Difference:This error may or may not reappear during runs of the GitHub Action.Fixes #22
IssueHunt Summary
Referenced issues
This pull request has been submitted to: