mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 05:41:20 -08:00
refactor(core): CORE-09 isolate source operations and settle cancelled switches
This commit is contained in:
1 parent
874dac9f22
commit
44f4e083a9
29 files changed
+4512
-255
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { mock } from 'node:test'
|
||||
|
||||
export function playbackFactory({ Emitter, playMix, pauseMix, toggleMix, switchMix }) {
|
||||
export function playbackFactory({ Emitter, playMix, pauseMix, toggleMix, switchMix, beginLifecycle }) {
|
||||
return function createArt(play = () => Promise.resolve(), playing = false) {
|
||||
const art = Object.assign(new Emitter(), {
|
||||
url: 'old.mp4',
|
||||
@@ -19,6 +19,7 @@ export function playbackFactory({ Emitter, playMix, pauseMix, toggleMix, switchM
|
||||
},
|
||||
},
|
||||
})
|
||||
beginLifecycle(art)
|
||||
Object.defineProperty(art, 'playing', { get: () => !art.template.$video.paused })
|
||||
for (const mix of [playMix, pauseMix, toggleMix, switchMix])
|
||||
mix(art)
|
||||
|
||||
Reference in new issue
Block a user