refactor(core): CORE-09 isolate source operations and settle cancelled switches

This commit is contained in:
Harvey Zhao committed 2026-09-11 02:34:26 +08:00
1 parent 874dac9f22
commit 44f4e083a9
29 files changed
+4512 -255

No files matched your search

@@ -0,0 +1,10 @@
import type { SwitchHost, SwitchMethods } from '../source/types'
import { switchSource } from '../source/switch'
import { def } from '../utils'
export default function switchMix(art: SwitchHost): asserts art is SwitchHost & SwitchMethods {
const switchUrl = (url: string) => switchSource(art, url, 0)
def(art, 'switchQuality', { value: (url: string) => switchSource(art, url, art.currentTime) })
def(art, 'switchUrl', { value: switchUrl })
def(art, 'switch', { set: switchUrl })
}