Move paste to renderer
The ‘clipboard’ module works in the renderer without using the ’remote’ package. So we can eliminate one IPC call this way :)
This commit is contained in:
14
main/ipc.js
14
main/ipc.js
@@ -9,10 +9,6 @@ var menu = require('./menu')
|
||||
var windows = require('./windows')
|
||||
|
||||
function init () {
|
||||
ipcMain.on('addTorrentFromPaste', function (e) {
|
||||
addTorrentFromPaste()
|
||||
})
|
||||
|
||||
ipcMain.on('setBounds', function (e, bounds) {
|
||||
setBounds(bounds)
|
||||
})
|
||||
@@ -42,16 +38,6 @@ function init () {
|
||||
})
|
||||
}
|
||||
|
||||
function addTorrentFromPaste () {
|
||||
debug('addTorrentFromPaste')
|
||||
var torrentIds = electron.clipboard.readText().split('\n')
|
||||
torrentIds.forEach(function (torrentId) {
|
||||
torrentId = torrentId.trim()
|
||||
if (torrentId.length === 0) return
|
||||
windows.main.send('addTorrent', torrentId)
|
||||
})
|
||||
}
|
||||
|
||||
function setBounds (bounds) {
|
||||
debug('setBounds %o', bounds)
|
||||
if (windows.main && !windows.main.isFullScreen() && !windows.main.isMaximized()) {
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = {
|
||||
var localShortcut = require('electron-localshortcut')
|
||||
|
||||
function init (menu) {
|
||||
// ⌘+Shift+F is an alternative fullscreen shortcut to the one defined in menu.js.
|
||||
// ⌘+Shift+F is an alternative fullscreen shortcut to the ones defined in menu.js.
|
||||
// Electron does not support multiple accelerators for a single menu item, so this
|
||||
// is registered separately here.
|
||||
localShortcut.register('CmdOrCtrl+Shift+F', menu.toggleFullScreen)
|
||||
|
||||
Reference in New Issue
Block a user