diff options
author | 2019-05-28 13:56:27 +0800 | |
---|---|---|
committer | 2019-05-28 13:56:27 +0800 | |
commit | 6f0864f9b73568f46d7f2019d8ae54cad5b67bc8 (patch) | |
tree | 45219ddc04eab8a994beb5039c95b8332688749b /source/libs/dom-utils.ts | |
parent | 44c3bf314b655b31e23ab36aeead8077a2a8bf93 (diff) | |
download | refined-github-6f0864f9b73568f46d7f2019d8ae54cad5b67bc8.tar.gz refined-github-6f0864f9b73568f46d7f2019d8ae54cad5b67bc8.tar.zst refined-github-6f0864f9b73568f46d7f2019d8ae54cad5b67bc8.zip |
Update `element-ready`
Diffstat (limited to '')
-rw-r--r-- | source/libs/dom-utils.ts | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/source/libs/dom-utils.ts b/source/libs/dom-utils.ts index 9b7a8941..eedd8921 100644 --- a/source/libs/dom-utils.ts +++ b/source/libs/dom-utils.ts @@ -1,20 +1,4 @@ import select from 'select-dom'; -import domLoaded from 'dom-loaded'; -import elementReady from 'element-ready'; - -/* - * Automatically stops checking for an element to appear once the DOM is ready. - */ -export const safeElementReady = <T extends Element>(selector: string): Promise<T | null> => { - const waiting = elementReady<T>(selector); - - // Don't check ad-infinitum - // eslint-disable-next-line promise/prefer-await-to-then - domLoaded.then(() => requestAnimationFrame(() => waiting.cancel())); - - // If cancelled, return null like a regular select() would - return waiting.catch(() => null); -}; /** * Append to an element, but before a element that might not exist. |