shortcuts.js: Consistent exported method naming

Exposed methods whose sole purpose is notify the module of an event
firing, should start with "on".
This commit is contained in:
Feross Aboukhadijeh
2016-05-11 19:56:06 +02:00
parent c99da2ccaa
commit 2005ee4d0b
3 changed files with 12 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
module.exports = {
init,
registerPlayerShortcuts,
unregisterPlayerShortcuts
onPlayerClose,
onPlayerOpen
}
var electron = require('electron')
@@ -19,11 +19,13 @@ function init () {
localShortcut.register('CmdOrCtrl+Shift+F', menu.toggleFullScreen)
}
function registerPlayerShortcuts () {
// Special "media key" for play/pause, available on some keyboards
globalShortcut.register('MediaPlayPause', () => windows.main.send('dispatch', 'playPause'))
function onPlayerOpen () {
// Register special "media key" for play/pause, available on some keyboards
globalShortcut.register('MediaPlayPause', function () {
windows.main.send('dispatch', 'playPause')
})
}
function unregisterPlayerShortcuts () {
function onPlayerClose () {
globalShortcut.unregister('MediaPlayPause')
}