This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

element-ready-es5

2.1.0 • Public • Published

element-ready-es5 Build Status

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

Install

There is no browser-ready package. You'll need browserify/webpack/rollup.

$ npm install --save element-ready-es5

Usage

var elementReady = require('element-ready-es5');

elementReady('#unicorn').then(function (element) {
	console.log(element.id);
	//=> 'unicorn'
});

API

elementReady(selector)

Returns a promise for a matching element.

selector

Type: string

CSS selector.

elementReadyPromise#cancel()

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.

Related

  • dom-loaded - Check when the DOM is loaded like DOMContentLoaded

License

MIT © Sindre Sorhus

Package Sidebar

Install

npm i element-ready-es5

Weekly Downloads

4

Version

2.1.0

License

MIT

Last publish

Collaborators

  • fregante