aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils.ts
diff options
context:
space:
mode:
authorMichael C <[email protected]>2021-12-31 17:30:17 -0500
committerMichael C <[email protected]>2021-12-31 17:30:17 -0500
commit229bd23a68771b88e4beed1c9106eb27f352efd5 (patch)
tree26f4063e3b127b18606ed9aa2c5d5880310445f0 /src/utils.ts
parent9b152a552505b561f4a68ad33e431c0b2c2d1ab8 (diff)
parent894410db98e421a5d1316387a969a191a8ad653e (diff)
downloadSponsorBlock-229bd23a68771b88e4beed1c9106eb27f352efd5.tar.gz
SponsorBlock-229bd23a68771b88e4beed1c9106eb27f352efd5.zip
Merge branch 'master' of https://github.com/ajayyy/SponsorBlock into channelTrailer
Diffstat (limited to 'src/utils.ts')
-rw-r--r--src/utils.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/utils.ts b/src/utils.ts
index 81be9488..7912c184 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -27,7 +27,10 @@ export default class Utils {
/** Function that can be used to wait for a condition before returning. */
async wait<T>(condition: () => T | false, timeout = 5000, check = 100): Promise<T> {
return await new Promise((resolve, reject) => {
- setTimeout(() => reject("TIMEOUT"), timeout);
+ setTimeout(() => {
+ clearInterval(interval);
+ reject("TIMEOUT");
+ }, timeout);
const intervalCheck = () => {
const result = condition();