From db92c84702117a0b4a92e065305b00890e95076a Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Thu, 18 Jul 2024 22:15:34 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Use=20setInterval=20to=20check?= =?UTF-8?q?=20if=20the=20DOM=20is=20fully=20loaded?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 69819fe..e0fefc6 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -370,9 +370,13 @@ export class LikeCoinWalletConnector { { - setTimeout(() => { - initAuthcore(this.options, { containerId, initialScreen }); - }, 100); + const intervalId = setInterval(() => { + const containerElement = document.getElementById(containerId); + if (containerElement) { + initAuthcore(this.options, { containerId, initialScreen }); + clearInterval(intervalId); + } + }, 200); }} onClose={() => { this.closeDialog();