From fa29a12d00ce705ffab01fe246895f444cf47e3d Mon Sep 17 00:00:00 2001 From: Send_Nukez Date: Sat, 18 Dec 2021 22:59:12 +0100 Subject: [PATCH] throw an error if the ready event is not fired after 50 tries --- src/js/Dribbblish.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/js/Dribbblish.js b/src/js/Dribbblish.js index 6885227..cd7b8ea 100644 --- a/src/js/Dribbblish.js +++ b/src/js/Dribbblish.js @@ -38,7 +38,9 @@ export default class Dribbblish { this.loader = new Loader(); this.icons = icons; + let tries = 0; const interval = setInterval(() => { + if (++tries > 50) throw new Error("ready timeout"); if (document.querySelector("#main") == null || Spicetify?.showNotification == undefined || !this.info.isReady()) return; this.#ready = true; this.emit("ready");