Skip to content

Commit

Permalink
[desktop] add option to toggle shared worker dev dev-tools
Browse files Browse the repository at this point in the history
Summary: Helps debugging sqlite.

Test Plan: Check if button works

Reviewers: michal

Reviewed By: michal

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D8369
  • Loading branch information
xsanm committed Jul 3, 2023
1 parent a351056 commit 4a4c8d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions desktop/flow-typed/npm/electron_v22.0.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ declare module 'electron' {
};
declare export type MenuItemConstructorOptions = {
click?: () => void,
label?: string,
submenu?: $ReadOnlyArray<MenuItemConstructorOptions>,
type?: 'normal' | 'separator' | 'submenu' | 'checkbox' | 'radio',
Expand Down Expand Up @@ -439,6 +440,7 @@ declare module 'electron' {
event: T,
listener: $ElementType<WebContentsEvents, T>,
): void;
inspectSharedWorker(): void;
}
declare type WebContentsEvents = {
'did-finish-load': () => void,
Expand Down
10 changes: 9 additions & 1 deletion desktop/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const scrollbarCSS = fs.promises.readFile(
'utf8',
);

let mainWindow = null;
const setApplicationMenu = () => {
let mainMenu = [];
if (isMac) {
Expand Down Expand Up @@ -60,6 +61,14 @@ const setApplicationMenu = () => {
{ type: 'separator' },
{ role: 'togglefullscreen' },
{ role: 'toggleDevTools' },
{
label: 'Toggle Shared Worker Developer Tools',
click: () => {
if (mainWindow) {
mainWindow.webContents.inspectSharedWorker();
}
},
},
],
};
const windowMenu = {
Expand Down Expand Up @@ -87,7 +96,6 @@ const setApplicationMenu = () => {
Menu.setApplicationMenu(menu);
};

let mainWindow = null;
const createMainWindow = (urlPath?: string) => {
const win = new BrowserWindow({
show: false,
Expand Down

0 comments on commit 4a4c8d8

Please sign in to comment.