mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
27 lines
459 B
JavaScript
27 lines
459 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) {
|
|
console.log(name)
|
|
remote.getCurrentWindow().webContents.send(name, ...args)
|
|
}
|
|
|
|
export default {
|
|
emit,
|
|
on,
|
|
off,
|
|
once
|
|
}
|