diff options
author | Michael C <[email protected]> | 2021-12-31 17:30:17 -0500 |
---|---|---|
committer | Michael C <[email protected]> | 2021-12-31 17:30:17 -0500 |
commit | 229bd23a68771b88e4beed1c9106eb27f352efd5 (patch) | |
tree | 26f4063e3b127b18606ed9aa2c5d5880310445f0 /src/utils.ts | |
parent | 9b152a552505b561f4a68ad33e431c0b2c2d1ab8 (diff) | |
parent | 894410db98e421a5d1316387a969a191a8ad653e (diff) | |
download | SponsorBlock-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.ts | 5 |
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(); |