使い方 waitForElement(selector, [timeout]) という感じで使います。 waitForElement()はPromiseを返すので、見つかったthenで登録したコールバックが呼ばれて、見つからなかったらcatchが呼ばれるという感じです。 Promiseについて詳しくはJavaScript Promiseの本を見てください /** * 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 waitForElem
![ある要素が表示されるまで待つJSライブラリを書いた(MutationObserver)](https://cdn-ak-scissors.b.st-hatena.com/image/square/b26f7dc8f9e783316f720174980e93c627438d74/height=288;version=1;width=512/https%3A%2F%2Fefcl.info%2Fpublic%2Ffavicon.png)