Skip to content

electron-utils/electron-ipc-listener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

electron-ipc-listener

Linux Build Status Windows Build status Dependency Status devDependency Status

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 string
  • callback function

Register IPC message and respond it with the callback function.

ipcListener.once (message, callback)

  • message string
  • callback function

Register IPC message and respond it once with the callback function.

ipcListener.clear ()

Clear all registered IPC messages in the listener.

License

MIT © 2017 Johnny Wu

About

IPC listener which will cache the callbacks for easily clear.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published