2.1.0 • Published 7 years ago

element-ready-es5 v2.1.0

Weekly downloads
12
License
MIT
Repository
github
Last release
7 years ago

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

2.1.0

7 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago