Clean up thumbar (thumbnail) code (#670)
* Cleanup thumbnail bar code - rename thumbnail method names for succinctness - Get rid of 'updateThumbnailBar' event -- use existing events - Get rid of 'blockPowerSave' and 'unblockPowerSave' events -- use a new combined 'onPlayerPlay' and 'onPlayerPause' events which apply to power save and updating the thumbbar * Consistent naming for enable/disable methods
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
start,
|
||||
stop
|
||||
enable,
|
||||
disable
|
||||
}
|
||||
|
||||
var electron = require('electron')
|
||||
@@ -12,19 +12,19 @@ var blockId = 0
|
||||
* Block the system from entering low-power (sleep) mode or turning off the
|
||||
* display.
|
||||
*/
|
||||
function start () {
|
||||
stop() // Stop the previous power saver block, if one exists.
|
||||
function enable () {
|
||||
disable() // Stop the previous power saver block, if one exists.
|
||||
blockId = electron.powerSaveBlocker.start('prevent-display-sleep')
|
||||
log(`powerSaveBlocker.start: ${blockId}`)
|
||||
log(`powerSaveBlocker.enable: ${blockId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop blocking the system from entering low-power mode.
|
||||
*/
|
||||
function stop () {
|
||||
function disable () {
|
||||
if (!electron.powerSaveBlocker.isStarted(blockId)) {
|
||||
return
|
||||
}
|
||||
electron.powerSaveBlocker.stop(blockId)
|
||||
log(`powerSaveBlocker.stop: ${blockId}`)
|
||||
log(`powerSaveBlocker.disable: ${blockId}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user