mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
19 lines
471 B
TypeScript
19 lines
471 B
TypeScript
import {webContents} from 'electron';
|
|
import {CHANNEL_LOG} from '../common/channels';
|
|
|
|
|
|
function sendIPCMsg(channel: string, ...data: any) {
|
|
let contents = webContents.getAllWebContents();
|
|
for (const content of contents) {
|
|
try {
|
|
content.send(channel, ...data)
|
|
} catch (e) {
|
|
console.log("llonebot send ipc msg to render error:", e)
|
|
}
|
|
}
|
|
}
|
|
|
|
export function sendLog(...args){
|
|
sendIPCMsg(CHANNEL_LOG, ...args)
|
|
}
|