-
-
Notifications
You must be signed in to change notification settings - Fork 18
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 stopOnDomReady
option, remove .cancel()
, add .stop()
#17
Conversation
Good timing. I already need to do a major release for other things in master.
👍
I commented inline. Can you fix the merge conflict? I think we should use |
cancelOnDomLoaded: true
optioncancelOnDomLoaded
option
Null is what querySelector returns, so I thought of keeping it consistent |
I’m trying to get rid of |
What’s wrong with null? Is it |
Are only docs missing here? |
Yes |
Good to go, however we should probably rename it:
So perhaps it should be |
I'm starting to think that I like |
index.js
Outdated
domLoaded.then(() => { | ||
cancelAnimationFrame(rafId); | ||
resolve(); | ||
}); |
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.
I know you hate this, but I prefer:
(async () => {
await domLoaded;
cancelAnimationFrame(rafId);
resolve();
})();
So I should drop |
Yes |
const { | ||
target = document, | ||
stopOnDomReady = true | ||
} = options; |
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.
Thoughts on this pattern instead?
const elementReady = (selector, {
target = document,
stopOnDomReady = true
} = {}) => {
// Code
};
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.
Sure, that's fine too. It just has a tendency to become kinda messy when you have a lot of options.
stopOnDomReady
optionstopOnDomReady
option, remove .cancel()
, add .stop()
Requires semver major because it changes the default behavior.
index.test-d.ts
withnull
, why is it failing?Fixes #8