1
0
mirror of https://github.com/rhysd/Mstdn.git synced 2025-01-21 20:52:11 +01:00
Mstdn/renderer/ipc.ts

15 lines
445 B
TypeScript
Raw Normal View History

2017-04-25 17:37:10 +09:00
import {ipcRenderer as ipc} from 'electron';
2017-04-16 02:27:06 +09:00
import log from './log';
export function on(channel: IpcChannelFromMain, callback: (...args: any[]) => void) {
ipc.on(channel, (_, ...args: any[]) => {
2017-04-17 18:40:55 +09:00
log.info('IPC: Received from:', channel, args);
2017-04-16 02:27:06 +09:00
callback(...args);
});
}
export function send(channel: IpcChannelFromRenderer, ...args: any[]) {
log.info('IPC: Send:', channel, args);
ipc.send(channel, ...args);
}