-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TypeScript errors, add return types for function declarations (do…
…ne converting to TypeScript)
- Loading branch information
Showing
20 changed files
with
157 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
const Store = require("electron-store"); | ||
import Store from "electron-store"; | ||
|
||
export const store = new Store({ | ||
defaults: { | ||
favoriteAnimal: "🦄" | ||
} | ||
}); | ||
function defaultStore(): Store { | ||
return new Store({ | ||
defaults: { | ||
favoriteAnimal: "🦄" | ||
} | ||
}); | ||
} | ||
|
||
export const configStore = defaultStore(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,42 @@ | ||
const { Menu } = require("electron"); | ||
const { is } = require("electron-util"); | ||
import { is } from "electron-util"; | ||
import { buildDebugSubmenu } from "./menu_debug"; | ||
import { buildDefaultOsTemplate } from "./menu_default"; | ||
import { buildMacOsTemplate } from "./menu_mac"; | ||
import { Menu, MenuItemConstructorOptions } from "electron"; | ||
|
||
function buildMenuTemplate() { | ||
let menuTemplate = | ||
process.platform === "darwin" | ||
? buildMacOsTemplate() | ||
: buildDefaultOsTemplate(); | ||
const PLATFORM_MAC = "darwin"; | ||
function isMac(): boolean { | ||
return process.platform === PLATFORM_MAC; | ||
} | ||
|
||
function buildDebugMenu(): MenuItemConstructorOptions { | ||
return { | ||
label: "Debug", | ||
type: "submenu", | ||
submenu: buildDebugSubmenu() | ||
}; | ||
} | ||
|
||
function buildMenuTemplate(): MenuItemConstructorOptions[] { | ||
let menuTemplate = isMac() ? buildMacOsTemplate() : buildDefaultOsTemplate(); | ||
|
||
if (is.development) { | ||
menuTemplate.push({ | ||
label: "Debug", | ||
submenu: buildDebugSubmenu() | ||
}); | ||
const debugMenu = buildDebugMenu(); | ||
|
||
menuTemplate.push(debugMenu); | ||
} | ||
|
||
return menuTemplate; | ||
} | ||
|
||
function buildMenu() { | ||
function buildMenu(): Menu { | ||
const menuTemplate = buildMenuTemplate(); | ||
|
||
return Menu.buildFromTemplate(menuTemplate); | ||
} | ||
|
||
export function setupMenu() { | ||
Menu.setApplicationMenu(buildMenu()); | ||
export function setupMenu(): void { | ||
const menu = buildMenu(); | ||
|
||
Menu.setApplicationMenu(menu); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.