Detect when an element is ready in the DOM
Compatible with browsers like Safari and IE11 (you'll have to polyfill Promise
in IE11)
=======
sindresorhus/master
There is no browser-ready package. You'll need browserify/webpack/rollup.
$ npm install --save element-ready-es5
var elementReady = require('element-ready-es5');
elementReady('#unicorn').then(function (element) {
console.log(element.id);
//=> 'unicorn'
});
Returns a promise for a matching element.
Type: string
Type: Function
Stops checking for the element to be ready. The cancelation is synchronous.
Calling it after the promise has settled or multiple times does nothing.
Based on p-cancelable.
-
dom-loaded - Check when the DOM is loaded like
DOMContentLoaded
MIT © Sindre Sorhus