This micro-library will allow you to easily delay code execution until the DOM is loaded.
npm install domloadedbash
npm install domloaded
`
Or download the built script files from GitHub Releases.
Basic Usage
`js
domloaded(() => { / dom is loaded... / });
`
Include with Express
1. First install the npm package.
`bash
npm install domloaded
`
2. Then serve the built script files via a static route.
`js
app.use('/js', express.static('node_modules/domloaded/dist'));
`
3. Then link the script in your HTML/view.
`html
`
4. And finally use it in your front-end code.
`js
domloaded(() => { / dom is loaded... / });
`
Include with Webpack/React
1. First install the npm package.
`bash
npm install domloaded
`
2. And then use it where needed:
`js
import domloaded from 'domloaded';
domloaded(() => { / dom is loaded... / });
``