diff options
author | Teddy Wing | 2020-05-24 10:55:09 +0200 |
---|---|---|
committer | Teddy Wing | 2020-05-24 11:07:40 +0200 |
commit | 2393b7b44826b2677660fa6dc162371151e00b2c (patch) | |
tree | 78de23d6b1696a60e44f55293e9f852495ab16c3 /src/index.ts | |
parent | ea6c52f4c8563503c06e5a91105e34e14ccf53ca (diff) | |
download | netflix-immersive-2393b7b44826b2677660fa6dc162371151e00b2c.tar.bz2 |
index.ts: Reinitialise when the page changesv0.0.1
Netflix doesn't reload when you change pages, so our listeners don't get
reinitialised.
This means, when you watch one video, then click the "Back to Browse"
button to go back to the /browse page, and select another video,
Immersive won't work on the newly-loaded video.
Ensure the plugin works in this case by reinitialising when the
`popstate` changes.
Diffstat (limited to 'src/index.ts')
-rw-r--r-- | src/index.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/index.ts b/src/index.ts index 9216a0a..58d4367 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,6 +20,14 @@ import styles from './styles'; import watch_credits from './watch_credits'; -styles(); -fullscreen_credits(); -watch_credits(); +function main () { + styles(); + fullscreen_credits(); + watch_credits(); +} + + +main(); + +// Reinitialise when the page changes. +window.onpopstate = main; |