0.0.2 • Published 5 years ago

ukogi v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

ukogi

A wrapper for Electron IPC for both main and renderer processes.

Functions

on(channel, callback)

Register a handler for an IPC channel

Kind: global function

ParamTypeDescription
channelstringName of the channel
callbackfunctionCallback to run when a message is received on this channel, called with arguments (event, arg, reply). Arguments passed to reply(arg) will be received by the callback in the corresponding ukogi.send call.

Example

ukogi.on("my-channel", (event, arg, reply) => {
  if (arg.flag) reply(42);
});

send(channel, arg, callback)

Send a message through an IPC channel and receive the response

Kind: global function

ParamTypeDescription
channelstringName of the channel
arg*Argument to pass
callbackfunctionCallback to run when a reply is received on this channel, called with arguments (event, arg). Arguments passed to the corresponding ukogi.on call's reply(arg) will be received here.

Example

ukogi.send("my-channel", { flag: true }, (event, arg) => console.log(arg)); // -> 42

License

MIT License

0.0.2

5 years ago

0.0.0

5 years ago