-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ambient-mode): fix ambient-mode not working for videos after rest…
…art (#2294) * Fix Ambient Mode not working for videos after restart (#2255) This should fix #1641 * fix: fix waitForElement --------- Co-authored-by: craftgeil <[email protected]>
- Loading branch information
1 parent
8924ec2
commit 7b033b5
Showing
4 changed files
with
24 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export const waitForElement = <T extends Element>(selector: string): Promise<T> => { | ||
return new Promise<T>((resolve) => { | ||
const interval = setInterval(() => { | ||
const elem = document.querySelector<T>(selector); | ||
if (!elem) return; | ||
|
||
clearInterval(interval); | ||
resolve(elem); | ||
}); | ||
}); | ||
}; |