mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-11 15:59:03 +00:00
fix(menu): hide titlebar extension if in browser
This commit is contained in:
parent
54594350bd
commit
f085362774
@ -7,7 +7,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const IS_ELECTRON = typeof module !== "undefined",
|
const IS_ELECTRON = typeof module !== "undefined",
|
||||||
IS_RENDERER = IS_ELECTRON && process.type === "renderer";
|
IS_RENDERER = IS_ELECTRON && process.type === "renderer",
|
||||||
|
whenReady = new Promise((res, rej) => {
|
||||||
|
(globalThis.__enhancerApi ??= {}).__isReady = res;
|
||||||
|
});
|
||||||
|
|
||||||
// expected values: 'linux', 'win32', 'darwin' (== macos), 'firefox'
|
// expected values: 'linux', 'win32', 'darwin' (== macos), 'firefox'
|
||||||
// and 'chromium' (inc. chromium-based browsers like edge and brave)
|
// and 'chromium' (inc. chromium-based browsers like edge and brave)
|
||||||
@ -158,4 +161,5 @@ Object.assign((globalThis.__enhancerApi ??= {}), {
|
|||||||
readJson,
|
readJson,
|
||||||
initDatabase,
|
initDatabase,
|
||||||
reloadApp,
|
reloadApp,
|
||||||
|
whenReady: (callback) => whenReady.then(callback),
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"id": "a5658d03-21c6-4088-bade-fa4780459133",
|
"id": "a5658d03-21c6-4088-bade-fa4780459133",
|
||||||
"name": "Titlebar",
|
"name": "Titlebar",
|
||||||
"version": "0.11.1",
|
"version": "0.11.1",
|
||||||
"environments": ["linux", "win32"],
|
"platforms": ["linux", "win32"],
|
||||||
"description": "Replaces the operating system's default window titlebar with buttons inset into the app.",
|
"description": "Replaces the operating system's default window titlebar with buttons inset into the app.",
|
||||||
"thumbnail": "integrated-titlebar.jpg",
|
"thumbnail": "integrated-titlebar.jpg",
|
||||||
"tags": ["extension", "layout"],
|
"tags": ["extension", "layout"],
|
||||||
|
19
src/init.js
19
src/init.js
@ -6,19 +6,12 @@
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
globalThis.__enhancerApi ??= {};
|
const isElectron = () => {
|
||||||
const whenReady = new Promise((res, rej) => {
|
try {
|
||||||
globalThis.__enhancerApi.__isReady = res;
|
return typeof module !== "undefined";
|
||||||
}),
|
} catch {}
|
||||||
isElectron = () => {
|
return false;
|
||||||
try {
|
};
|
||||||
return typeof module !== "undefined";
|
|
||||||
} catch {}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
Object.assign((globalThis.__enhancerApi ??= {}), {
|
|
||||||
whenReady: (callback) => whenReady.then(callback),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isElectron()) {
|
if (isElectron()) {
|
||||||
require("./common/system.js");
|
require("./common/system.js");
|
||||||
|
Loading…
Reference in New Issue
Block a user