mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
refactor(store): remove partial slice state updates (#296)
This commit is contained in:
@@ -22,9 +22,8 @@ export const bufferSlice = createSlice<HTMLMediaElement>()({
|
||||
}),
|
||||
|
||||
subscribe: ({ target, update, signal }) => {
|
||||
const sync = () => update();
|
||||
listen(target, 'progress', sync, { signal });
|
||||
listen(target, 'emptied', sync, { signal });
|
||||
listen(target, 'progress', update, { signal });
|
||||
listen(target, 'emptied', update, { signal });
|
||||
},
|
||||
|
||||
request: {},
|
||||
|
||||
@@ -28,12 +28,11 @@ export const playbackSlice = createSlice<HTMLMediaElement>()({
|
||||
}),
|
||||
|
||||
subscribe: ({ target, update, signal }) => {
|
||||
const sync = () => update();
|
||||
listen(target, 'play', sync, { signal });
|
||||
listen(target, 'pause', sync, { signal });
|
||||
listen(target, 'ended', sync, { signal });
|
||||
listen(target, 'playing', sync, { signal });
|
||||
listen(target, 'waiting', sync, { signal });
|
||||
listen(target, 'play', update, { signal });
|
||||
listen(target, 'pause', update, { signal });
|
||||
listen(target, 'ended', update, { signal });
|
||||
listen(target, 'playing', update, { signal });
|
||||
listen(target, 'waiting', update, { signal });
|
||||
},
|
||||
|
||||
request: {
|
||||
|
||||
@@ -22,11 +22,10 @@ export const sourceSlice = createSlice<HTMLMediaElement>()({
|
||||
}),
|
||||
|
||||
subscribe: ({ target, update, signal }) => {
|
||||
const sync = () => update();
|
||||
listen(target, 'canplay', sync, { signal });
|
||||
listen(target, 'canplaythrough', sync, { signal });
|
||||
listen(target, 'loadstart', sync, { signal });
|
||||
listen(target, 'emptied', sync, { signal });
|
||||
listen(target, 'canplay', update, { signal });
|
||||
listen(target, 'canplaythrough', update, { signal });
|
||||
listen(target, 'loadstart', update, { signal });
|
||||
listen(target, 'emptied', update, { signal });
|
||||
},
|
||||
|
||||
request: {
|
||||
|
||||
@@ -22,12 +22,11 @@ export const timeSlice = createSlice<HTMLMediaElement>()({
|
||||
}),
|
||||
|
||||
subscribe: ({ target, update, signal }) => {
|
||||
const sync = () => update();
|
||||
listen(target, 'timeupdate', sync, { signal });
|
||||
listen(target, 'durationchange', sync, { signal });
|
||||
listen(target, 'seeked', sync, { signal });
|
||||
listen(target, 'loadedmetadata', sync, { signal });
|
||||
listen(target, 'emptied', sync, { signal });
|
||||
listen(target, 'timeupdate', update, { signal });
|
||||
listen(target, 'durationchange', update, { signal });
|
||||
listen(target, 'seeked', update, { signal });
|
||||
listen(target, 'loadedmetadata', update, { signal });
|
||||
listen(target, 'emptied', update, { signal });
|
||||
},
|
||||
|
||||
request: {
|
||||
|
||||
@@ -22,8 +22,7 @@ export const volumeSlice = createSlice<HTMLMediaElement>()({
|
||||
}),
|
||||
|
||||
subscribe: ({ target, update, signal }) => {
|
||||
const sync = () => update();
|
||||
listen(target, 'volumechange', sync, { signal });
|
||||
listen(target, 'volumechange', update, { signal });
|
||||
},
|
||||
|
||||
request: {
|
||||
|
||||
Reference in New Issue
Block a user