diff options
author | Teddy Wing | 2020-05-06 02:01:00 +0200 |
---|---|---|
committer | Teddy Wing | 2020-05-06 02:17:02 +0200 |
commit | 5c3ee5406f842cec9e4db2e297c006b12cbf5dfc (patch) | |
tree | 848849f0c5cef25ffbdb9171303e258fdeabf004 /src/player.ts | |
parent | 175cd65ca3fa906ab3d9b663ae932b7d01f071a5 (diff) | |
download | netflix-immersive-5c3ee5406f842cec9e4db2e297c006b12cbf5dfc.tar.bz2 |
Move `with_player` to a new module
Move this function to a new module as I'd like to use it for checking
the "Watch Credits" button.
Also change from a callback to a `Promise`. Need to include the
`Promise` lib via ES2015 in tsconfig to be able to build with promises.
Diffstat (limited to 'src/player.ts')
-rw-r--r-- | src/player.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/player.ts b/src/player.ts new file mode 100644 index 0000000..ea0e541 --- /dev/null +++ b/src/player.ts @@ -0,0 +1,16 @@ +export default function with_player (): Promise<HTMLElement> { + return new Promise(function(resolve) { + const interval = setInterval( + function() { + const player = document.querySelector('.NFPlayer.nf-player-container'); + + if (player) { + clearInterval(interval); + + resolve(player); + } + }, + 1000 + ); + }); +} |