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:
@@ -82,12 +82,12 @@ function init () {
|
|||||||
|
|
||||||
ipcMain.on('onPlayerOpen', function () {
|
ipcMain.on('onPlayerOpen', function () {
|
||||||
menu.onPlayerOpen()
|
menu.onPlayerOpen()
|
||||||
shortcuts.registerPlayerShortcuts()
|
shortcuts.onPlayerOpen()
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('onPlayerClose', function () {
|
ipcMain.on('onPlayerClose', function () {
|
||||||
menu.onPlayerClose()
|
menu.onPlayerClose()
|
||||||
shortcuts.unregisterPlayerShortcuts()
|
shortcuts.onPlayerOpen()
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('focusWindow', function (e, windowName) {
|
ipcMain.on('focusWindow', function (e, windowName) {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ module.exports = {
|
|||||||
onToggleFullScreen,
|
onToggleFullScreen,
|
||||||
onWindowHide,
|
onWindowHide,
|
||||||
onWindowShow,
|
onWindowShow,
|
||||||
|
|
||||||
|
// TODO: move these out of menu.js -- they don't belong here
|
||||||
showOpenSeedFiles,
|
showOpenSeedFiles,
|
||||||
showOpenTorrentAddress,
|
showOpenTorrentAddress,
|
||||||
showOpenTorrentFile,
|
showOpenTorrentFile,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
init,
|
init,
|
||||||
registerPlayerShortcuts,
|
onPlayerClose,
|
||||||
unregisterPlayerShortcuts
|
onPlayerOpen
|
||||||
}
|
}
|
||||||
|
|
||||||
var electron = require('electron')
|
var electron = require('electron')
|
||||||
@@ -19,11 +19,13 @@ function init () {
|
|||||||
localShortcut.register('CmdOrCtrl+Shift+F', menu.toggleFullScreen)
|
localShortcut.register('CmdOrCtrl+Shift+F', menu.toggleFullScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerPlayerShortcuts () {
|
function onPlayerOpen () {
|
||||||
// Special "media key" for play/pause, available on some keyboards
|
// Register special "media key" for play/pause, available on some keyboards
|
||||||
globalShortcut.register('MediaPlayPause', () => windows.main.send('dispatch', 'playPause'))
|
globalShortcut.register('MediaPlayPause', function () {
|
||||||
|
windows.main.send('dispatch', 'playPause')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function unregisterPlayerShortcuts () {
|
function onPlayerClose () {
|
||||||
globalShortcut.unregister('MediaPlayPause')
|
globalShortcut.unregister('MediaPlayPause')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user