refactor: replace a few usages of V8 hidden properties (#29400)

This commit is contained in:
Milan Burda 2021-06-03 07:59:56 +02:00 committed by GitHub
parent bb6903543c
commit 8d0ed05c99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 17 deletions

View file

@ -1,12 +1,16 @@
import { app, Menu } from 'electron/main';
import { shell } from 'electron/common';
const v8Util = process._linkedBinding('electron_common_v8_util');
const isMac = process.platform === 'darwin';
let applicationMenuWasSet = false;
export const setApplicationMenuWasSet = () => {
applicationMenuWasSet = true;
};
export const setDefaultApplicationMenu = () => {
if (v8Util.getHiddenValue<boolean>(global, 'applicationMenuSet')) return;
if (applicationMenuWasSet) return;
const helpMenu: Electron.MenuItemConstructorOptions = {
role: 'help',