Check when the DOM is loaded

Renamed to when-dom-ready
Last updated 4 years ago by lukechilds .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install domloaded 
SYNC missed versions from official npm registry.


Check when the DOM is loaded

Build Status Coverage Status

Returns a Promise for cleaner usage and can also be used as pure function.


npm install --save domloaded


import domLoaded from 'domloaded';

domLoaded().then(() => console.log('DOM is loaded yo!'));

You can still use callbacks if you want to:

domLoaded(() => console.log('DOM is loaded yo!'));

Pure usage

You can make the function pure by passing in a document object. This is really useful for tests and mocking environments.

For example this works in Node.js:

import jsdom from 'jsdom';
import domLoaded from 'domloaded';

const doc = jsdom.jsdom('').defaultView.document;

domLoaded(doc).then(() => console.log('DOM is loaded yo!'));

Again, you can use the callback version as a pure function too:

domLoaded(() => console.log('DOM is loaded yo!'), doc);


MIT © Luke Childs

Current Tags

  • 0.1.0                                ...           latest (4 years ago)

1 Versions

  • 0.1.0 [deprecated]           ...           4 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
Dev Dependencies (6)
Dependents (0)

Copyright 2014 - 2016 © |