Fix injection for canary

This commit is contained in:
Zack Rauen 2022-04-10 17:03:28 -04:00
parent 7bdf2b630f
commit 9ee2ee6738
1 changed files with 1 additions and 8 deletions

View File

@ -30,15 +30,8 @@ Object.assign(BrowserWindow, electron.BrowserWindow);
export default class {
static patchBrowserWindow() {
// Reassign electron using proxy to avoid the onReady issue, thanks Powercord!
const newElectron = new Proxy(electron, {
get: function(target, prop) {
if (prop === "BrowserWindow") return BrowserWindow;
return target[prop];
}
});
const electronPath = __non_webpack_require__.resolve("electron");
delete __non_webpack_require__.cache[electronPath].exports; // If it didn't work, try to delete existing
__non_webpack_require__.cache[electronPath].exports = newElectron; // Try to assign again after deleting
__non_webpack_require__.cache[electronPath].exports = {...electron, BrowserWindow}; // Try to assign again after deleting
}
}