Prevent input event from main process
This commit is contained in:
parent
5ae80d541b
commit
7a5ec96d53
2 changed files with 9 additions and 6 deletions
|
@ -8,6 +8,7 @@ const ipcMain = electron.ipcMain
|
|||
const dialog = electron.dialog
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
const protocol = electron.protocol
|
||||
const webContents = electron.webContents
|
||||
const v8 = require('v8')
|
||||
|
||||
const Coverage = require('electabul').Coverage
|
||||
|
@ -184,6 +185,12 @@ app.on('ready', function () {
|
|||
event.returnValue = 'done'
|
||||
})
|
||||
|
||||
ipcMain.on('prevent-next-input-event', (event, key, id) => {
|
||||
webContents.fromId(id).once('before-input-event', (event, input) => {
|
||||
if (key === input.key) event.preventDefault()
|
||||
})
|
||||
})
|
||||
|
||||
ipcMain.on('executeJavaScript', function (event, code, hasCallback) {
|
||||
if (hasCallback) {
|
||||
window.webContents.executeJavaScript(code, (result) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue