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
ready function request #18
Comments
Would you mainly be using this like the old jQuery way. As your example shows ? Essentially waiting for the DOM to be loaded in order to start manipulating the DOM. My goal is to keep the library as small as possibly. I think this is a useful add, but I am wondering if I can just let people import as a separate module. Which would have a different syntax. import { $, ready } from 'quantdom'
ready(window).then(()=> {
//do something after the dom has loaded
$('.some-el').text('Look at me mom, the DOM is loaded!!!')
});
//or even just (a function I already have)
import { $, docReady } from 'quantdom'
docReady(() =>{
//do something after the dom has loaded
$('.some-el').text('Look at me mom, the DOM is loaded!!!')
}) By not making this part of the Quantdom class. I can make this tree shakable. Do you see any reason something like this wouldn't work or do you think you need it be part of the Quantdom instance i.e. $(window).ready() ? If so please explain ? I am open to either or but again the benefit of making a separate function is tree shaking in order to keep over all library low. My though is to start doing this for additional features or make some type of plugin system in order to keep the core Quantdom super small but extendable where needed! BTW Thanks for your feedback! Really appreciate it! |
Your Above Suggestion or example is really useful as well, thanks :D |
I added it to version 1.2.8. I may change it in the future and it works differently than jQuery. $().docReady(function(){
console.log('DOM READY')
//do all your DOM stuff here
}) Passing in an element i.e.
|
First i would like to thank you for this awesome library you developed :)
Second this is not an issues actually it's a feature request..
i would like to see
"Selector.ready()"
feature in the upcoming build.Regards..
The text was updated successfully, but these errors were encountered: