decrease setProgress updates (#833)

This commit is contained in:
Mathias Rasmussen
2016-08-25 04:16:30 +02:00
committed by GitHub
parent d2da6881d6
commit f1cf37200e
2 changed files with 6 additions and 2 deletions

View File

@@ -24,7 +24,11 @@ function getDefaultState () {
*/ */
client: null, /* the WebTorrent client */ client: null, /* the WebTorrent client */
server: null, /* local WebTorrent-to-HTTP server */ server: null, /* local WebTorrent-to-HTTP server */
prev: {}, /* used for state diffing in updateElectron() */ prev: { /* used for state diffing in updateElectron() */
title: null,
progress: -1,
badge: null
},
location: new LocationHistory(), location: new LocationHistory(),
window: { window: {
bounds: null, /* {x, y, width, height } */ bounds: null, /* {x, y, width, height } */

View File

@@ -157,7 +157,7 @@ function updateElectron () {
state.prev.title = state.window.title state.prev.title = state.window.title
ipcRenderer.send('setTitle', state.window.title) ipcRenderer.send('setTitle', state.window.title)
} }
if (state.dock.progress !== state.prev.progress) { if (state.dock.progress.toFixed(2) !== state.prev.progress.toFixed(2)) {
state.prev.progress = state.dock.progress state.prev.progress = state.dock.progress
ipcRenderer.send('setProgress', state.dock.progress) ipcRenderer.send('setProgress', state.dock.progress)
} }