Skip to content

Instantly share code, notes, and snippets.

View dfahlander's full-sized avatar

David Fahlander dfahlander

  • Awarica AB
  • Stockholm
View GitHub Profile
// This module shall be imported from BrowserWindow's main modules. The node main thread should instead import "workaround-ipc".
// NOTE: This gist shall not be used if Electron solves issue https://github.com/electron/electron/issues/37417
import Dexie from "dexie";
import { ipcRenderer } from "electron";
if ("unref" in BroadcastChannel.prototype) {
// Node's BroadcastChannel has the `unref()` method.
// Seems we got the Node- and not the DOM version of BroadcastChannel.
// Only activate this workaround when we have the Node-version of BroadcastChannel