Skip to content

Commit fe06293

Browse files
authored
feat: support reload and force reload in desktop app (#127)
1 parent 255d320 commit fe06293

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

src/main/menu.ts

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ export default class MenuBuilder {
110110
this.mainWindow.webContents.reload();
111111
},
112112
},
113+
{
114+
label: "Force Reload",
115+
accelerator: "Shift+Command+R",
116+
click: () => {
117+
this.mainWindow.webContents.reloadIgnoringCache();
118+
},
119+
},
120+
{
121+
type: "separator",
122+
},
113123
{
114124
label: "Toggle Full Screen",
115125
accelerator: "Ctrl+Command+F",
@@ -156,6 +166,23 @@ export default class MenuBuilder {
156166
const subMenuViewProd: MenuItemConstructorOptions = {
157167
label: "View",
158168
submenu: [
169+
{
170+
label: "Reload",
171+
accelerator: "Command+R",
172+
click: () => {
173+
this.mainWindow.webContents.reload();
174+
},
175+
},
176+
{
177+
label: "Force Reload",
178+
accelerator: "Shift+Command+R",
179+
click: () => {
180+
this.mainWindow.webContents.reloadIgnoringCache();
181+
},
182+
},
183+
{
184+
type: "separator",
185+
},
159186
{
160187
label: "Toggle Full Screen",
161188
accelerator: "Ctrl+Command+F",
@@ -277,12 +304,22 @@ export default class MenuBuilder {
277304
process.env.DEBUG_PROD === "true"
278305
? [
279306
{
280-
label: "&Reload",
307+
label: "Reload",
281308
accelerator: "Ctrl+R",
282309
click: () => {
283310
this.mainWindow.webContents.reload();
284311
},
285312
},
313+
{
314+
label: "Force Reload",
315+
accelerator: "Ctrl+Shift+R",
316+
click: () => {
317+
this.mainWindow.webContents.reloadIgnoringCache();
318+
},
319+
},
320+
{
321+
type: "separator",
322+
},
286323
{
287324
label: "Toggle &Full Screen",
288325
accelerator: "F11",
@@ -328,6 +365,23 @@ export default class MenuBuilder {
328365
},
329366
]
330367
: [
368+
{
369+
label: "Reload",
370+
accelerator: "Ctrl+R",
371+
click: () => {
372+
this.mainWindow.webContents.reload();
373+
},
374+
},
375+
{
376+
label: "Force Reload",
377+
accelerator: "Ctrl+Shift+R",
378+
click: () => {
379+
this.mainWindow.webContents.reloadIgnoringCache();
380+
},
381+
},
382+
{
383+
type: "separator",
384+
},
331385
{
332386
label: "Toggle &Full Screen",
333387
accelerator: "F11",

0 commit comments

Comments
 (0)