up
This commit is contained in:
@@ -214,6 +214,13 @@ export function send(controller: Controller, intent: Intent) {
|
||||
}
|
||||
// Сравниваем с предыдущим ответом сервера, а не с локальными действиями ведущего.
|
||||
export function applyRemote(controller: Controller, previous: RemoteState, next: RemoteState) {
|
||||
const old = previous.music
|
||||
const music = next.music
|
||||
// Новая версия музыки означает отдельную серверную команду, даже при тех же значениях.
|
||||
const musicChanged = !!old && !!music && music.version > old.version
|
||||
controller.synchronizeRemote(() => applyRemoteState(controller, previous, next), musicChanged)
|
||||
}
|
||||
function applyRemoteState(controller: Controller, previous: RemoteState, next: RemoteState) {
|
||||
if (next.sound !== previous.sound) send(controller, { action: 'mute', enabled: !next.sound })
|
||||
if (next.version > previous.version) {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user