mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Using console in production is generally undesirable due to performance loss and security concerns. Errors were changed to console.error and console.logs were removed.
26 lines
439 B
JavaScript
26 lines
439 B
JavaScript
const electron = require('electron')
|
|
const { ipcRenderer, remote } = electron
|
|
|
|
function on (name, listener) {
|
|
ipcRenderer.on(name, listener)
|
|
}
|
|
|
|
function off (name, listener) {
|
|
ipcRenderer.removeListener(name, listener)
|
|
}
|
|
|
|
function once (name, listener) {
|
|
ipcRenderer.once(name, listener)
|
|
}
|
|
|
|
function emit (name, ...args) {
|
|
remote.getCurrentWindow().webContents.send(name, ...args)
|
|
}
|
|
|
|
export default {
|
|
emit,
|
|
on,
|
|
off,
|
|
once
|
|
}
|