wait-for-element
v1.0.2
Published
wait for element function.
Readme
wait-for-element.js 
This library provide a function which wait until an element is visible.
Installation
npm install wait-for-element.jsDependency
- Promise API
if you use it with non promise support browser, should load Promise polyfill like ES6-Promise.
Usage
For details, please see Example.
/**
* Wait until an element that is matched the selector is visible.
* @param {string} selector the css selector
* @param {number} timeout the timeout is millisecond. default:2000ms
* @returns {Promise}
*/
var waitForElement = require("wait-for-element");
waitForElement("#js-element").then(function (element) {
alert("Found #js-element");
}).catch(console.error.bind(console));Tests
npm testContributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
License
MIT
