mirror of
https://github.com/burrow-dev/burrow-client.git
synced 2026-11-18 17:37:50 -05:00
37 lines
759 B
JavaScript
37 lines
759 B
JavaScript
"use strict";
|
|
|
|
const { ipcRenderer, contextBridge } = require("electron");
|
|
|
|
const sendWhitelist = new Set()
|
|
.add("initialized")
|
|
.add("fps")
|
|
.add("openPage")
|
|
.add("printImage")
|
|
.add("reloadGame")
|
|
.add("reportError")
|
|
.add("signupCompleted");
|
|
|
|
const receiveWhitelist = new Set()
|
|
.add("flashVarsReady")
|
|
.add("hud")
|
|
.add("removed");
|
|
|
|
contextBridge.exposeInMainWorld(
|
|
"ipc", {
|
|
sendToHost: (channel, ...args) => {
|
|
if (sendWhitelist.has(channel)) {
|
|
ipcRenderer.sendToHost(channel, ...args);
|
|
}
|
|
},
|
|
on: (channel, listener) => {
|
|
if (receiveWhitelist.has(channel)) {
|
|
ipcRenderer.on(channel, listener);
|
|
}
|
|
}
|
|
}
|
|
);
|
|
|
|
ipcRenderer.on("redirect-url", (event, url) => {
|
|
console.log("REDIRECT");
|
|
});
|