From e905467852ed3d5321e5dcc0256e4434a2e08826 Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Thu, 20 Aug 2020 23:18:55 +0800 Subject: [PATCH] expose APIs as public API --- public/index.html | 1 + src/Controller.svelte | 10 +++++++--- src/Player.svelte | 21 +++++++++++++++++++-- typings/index.d.ts | 3 +++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/public/index.html b/public/index.html index 56ec245e..e05b1b83 100644 --- a/public/index.html +++ b/public/index.html @@ -26,6 +26,7 @@ autoPlay: false, }, }); + window.$c = component; component.addEventListener('finish', () => console.log('finish')); diff --git a/src/Controller.svelte b/src/Controller.svelte index 3140f199..22e30c58 100644 --- a/src/Controller.svelte +++ b/src/Controller.svelte @@ -102,7 +102,7 @@ } }; - const toggle = () => { + export const toggle = () => { switch (playerState) { case 'playing': replayer.pause(); @@ -142,7 +142,7 @@ } }; - const setSpeed = (newSpeed: number) => { + export const setSpeed = (newSpeed: number) => { let needFreeze = playerState === 'playing'; speed = newSpeed; if (needFreeze) { @@ -154,6 +154,10 @@ } }; + export const toggleSkipInactive = () => { + skipInactive = !skipInactive; + }; + onMount(() => { playerState = replayer.service.state.value as typeof playerState; speedState = replayer.speedService.state.value as typeof speedState; @@ -320,7 +324,7 @@