Skip to content

Commit

Permalink
Stop if dom was already ready
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante authored Aug 20, 2024
1 parent 4743d5e commit e906148
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export default function elementReady(selector, {
return cachedPromise;
}

if (stopOnDomReady && isDomReady(target)) {
const promise = Promise.resolve(getMatchingElement({target, selector, predicate}));
promise.stop = () => {};
return promise;
}

let shouldStop = false;

const stop = () => {
Expand Down

0 comments on commit e906148

Please sign in to comment.