summaryrefslogtreecommitdiff
path: root/source/helpers/on-element-removal.ts
diff options
context:
space:
mode:
authorGravatar yakov116 <16872793+yakov116@users.noreply.github.com> 2020-11-18 19:55:59 -0500
committerGravatar GitHub <noreply@github.com> 2020-11-18 18:55:59 -0600
commita935456acab0c7bdc021829e18ce20230e18c752 (patch)
treee61eed13a433381ba223a4ca962e904c8740fc91 /source/helpers/on-element-removal.ts
parentcab33f6f47c4eef0a3bc793f2004767f34b6abe9 (diff)
downloadrefined-github-a7e8057d2e873d04e02d03e393b5ff604298d6b2.tar.gz
refined-github-a7e8057d2e873d04e02d03e393b5ff604298d6b2.tar.zst
refined-github-a7e8057d2e873d04e02d03e393b5ff604298d6b2.zip
Lint (#3723)20.11.19
Diffstat (limited to 'source/helpers/on-element-removal.ts')
-rw-r--r--source/helpers/on-element-removal.ts24
1 files changed, 13 insertions, 11 deletions
diff --git a/source/helpers/on-element-removal.ts b/source/helpers/on-element-removal.ts
index 2c94a168..27e8b3b4 100644
--- a/source/helpers/on-element-removal.ts
+++ b/source/helpers/on-element-removal.ts
@@ -1,15 +1,17 @@
import mem from 'mem';
-const onElementRemoval = mem(async (element: Element): Promise<void> => {
- return new Promise(resolve => {
- // @ts-expect-error until https://github.com/microsoft/TypeScript/issues/37861
- new ResizeObserver(([{target}], observer) => {
- if (!target.isConnected) {
- observer.disconnect();
- resolve();
- }
- }).observe(element);
- });
-});
+const onElementRemoval = mem(
+ async (element: Element): Promise<void> => (
+ new Promise(resolve => {
+ // @ts-expect-error until https://github.com/microsoft/TypeScript/issues/37861
+ new ResizeObserver(([{target}], observer) => {
+ if (!target.isConnected) {
+ observer.disconnect();
+ resolve();
+ }
+ }).observe(element);
+ })
+ )
+);
export default onElementRemoval;