aboutsummaryrefslogtreecommitdiffstats
path: root/src/fullscreen_credits.ts
diff options
context:
space:
mode:
authorTeddy Wing2020-05-06 02:01:00 +0200
committerTeddy Wing2020-05-06 02:17:02 +0200
commit5c3ee5406f842cec9e4db2e297c006b12cbf5dfc (patch)
tree848849f0c5cef25ffbdb9171303e258fdeabf004 /src/fullscreen_credits.ts
parent175cd65ca3fa906ab3d9b663ae932b7d01f071a5 (diff)
downloadnetflix-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/fullscreen_credits.ts')
-rw-r--r--src/fullscreen_credits.ts16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/fullscreen_credits.ts b/src/fullscreen_credits.ts
index 6d174ed..d8b68b9 100644
--- a/src/fullscreen_credits.ts
+++ b/src/fullscreen_credits.ts
@@ -1,17 +1,5 @@
-function with_player (callback) {
- var interval = setInterval(
- function() {
- var player = document.querySelector('.NFPlayer.nf-player-container');
+import with_player from './player';
- if (player) {
- clearInterval(interval);
-
- callback(player);
- }
- },
- 1000
- );
-}
function init_mutation_observer (player) {
var observer = new MutationObserver(function(mutation_list) {
@@ -60,7 +48,7 @@ function init_mutation_observer (player) {
}
export default function init () {
- with_player(function(player) {
+ with_player().then(function(player) {
init_mutation_observer(player);
});
}