add inline doc

This commit is contained in:
Araxeus
2021-04-06 01:30:47 +03:00
parent 724c213af1
commit 0e9b15722a
6 changed files with 148 additions and 105 deletions

View File

@ -1,11 +1,15 @@
const { ipcRenderer } = require("electron");
function logToString(log) {
let string = (typeof log === "string") ? log : log.toString();
if (!string || string.includes("[object Object]")) {
string = JSON.stringify(log);
}
return string;
}
module.exports = () => {
ipcRenderer.on("log", (event, log) => {
let string = log || log.toString();
if (!string || string === "[object Object]") {
string = JSON.stringify(log);
}
console.log(string);
})
};
ipcRenderer.on("log", (event, log) => {
console.log(logToString(log));
});
};