electron-ipc-listener
v1.0.0
Published
Ipc Listener
Downloads
10
Readme
electron-ipc
IPC listener which will cache the callbacks for easily clear.
Install
npm install --save electron-ipc-listener
Usage
const IpcListener = require('electron-ipc-listener');
let ipcListener = new IpcListener();
ipcListener.on('foo:bar', event => {
// do something...
});
// ...
// ...
// once you do not need the ipcListener ...
ipcListener.clear();
API Reference
Class: IpcListener
new IpcListener();
Instance Methods
ipcListener.on (message, callback)
message
stringcallback
function
Register IPC message and respond it with the callback function.
ipcListener.once (message, callback)
message
stringcallback
function
Register IPC message and respond it once with the callback function.
ipcListener.clear ()
Clear all registered IPC messages in the listener.
License
MIT © 2016 Johnny Wu