UI responds instantly to torrent enable/disable (#208)
This commit is contained in:
@@ -164,9 +164,11 @@ function updateElectron () {
|
|||||||
|
|
||||||
// Events from the UI never modify state directly. Instead they call dispatch()
|
// Events from the UI never modify state directly. Instead they call dispatch()
|
||||||
function dispatch (action, ...args) {
|
function dispatch (action, ...args) {
|
||||||
if (['mediaMouseMoved', 'playbackJump'].indexOf(action) === -1) {
|
// Log dispatch calls, for debugging
|
||||||
console.log('dispatch: %s %o', action, args) /* log user interactions, but don't spam */
|
if (action !== 'mediaMouseMoved') {
|
||||||
|
console.log('dispatch: %s %o', action, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action === 'onOpen') {
|
if (action === 'onOpen') {
|
||||||
onOpen(args[0] /* files */)
|
onOpen(args[0] /* files */)
|
||||||
}
|
}
|
||||||
@@ -221,11 +223,9 @@ function dispatch (action, ...args) {
|
|||||||
}
|
}
|
||||||
if (action === 'back') {
|
if (action === 'back') {
|
||||||
state.location.back()
|
state.location.back()
|
||||||
update()
|
|
||||||
}
|
}
|
||||||
if (action === 'forward') {
|
if (action === 'forward') {
|
||||||
state.location.forward()
|
state.location.forward()
|
||||||
update()
|
|
||||||
}
|
}
|
||||||
if (action === 'playPause') {
|
if (action === 'playPause') {
|
||||||
playPause()
|
playPause()
|
||||||
@@ -252,14 +252,16 @@ function dispatch (action, ...args) {
|
|||||||
}
|
}
|
||||||
if (action === 'toggleFullScreen') {
|
if (action === 'toggleFullScreen') {
|
||||||
ipcRenderer.send('toggleFullScreen', args[0])
|
ipcRenderer.send('toggleFullScreen', args[0])
|
||||||
update()
|
|
||||||
}
|
}
|
||||||
if (action === 'mediaMouseMoved') {
|
if (action === 'mediaMouseMoved') {
|
||||||
state.playing.mouseStationarySince = new Date().getTime()
|
state.playing.mouseStationarySince = new Date().getTime()
|
||||||
update()
|
|
||||||
}
|
}
|
||||||
if (action === 'exitModal') {
|
if (action === 'exitModal') {
|
||||||
state.modal = null
|
state.modal = null
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the virtual-dom, unless it's just a mouse move event
|
||||||
|
if (action !== 'mediaMouseMoved') {
|
||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user