From 1a7745345bc177265fa3252626bc89eb5cd7a58a Mon Sep 17 00:00:00 2001 From: rhysd Date: Tue, 20 Jun 2017 17:39:07 +0900 Subject: [PATCH] update dependencies and avoid Electron's official type definitions --- main/window.ts | 2 +- package.json | 19 ++++++++------- typings/menubar.d.ts | 55 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 11 deletions(-) create mode 100644 typings/menubar.d.ts diff --git a/main/window.ts b/main/window.ts index 731f882..c6ad2d4 100644 --- a/main/window.ts +++ b/main/window.ts @@ -115,7 +115,7 @@ export default class Window { this.browser.removeAllListeners(); if (this.menubar) { // Note: - // menubar.windowClear() won't be called because all listners were removed + // menubar.windowClear() won't be called because all listeners were removed delete this.menubar.window; } this.browser.close(); diff --git a/package.json b/package.json index 0a53437..8d27f8a 100644 --- a/package.json +++ b/package.json @@ -37,22 +37,21 @@ }, "homepage": "https://github.com/rhysd/Mstdn#readme", "devDependencies": { - "@types/electron": "^1.4.37", + "@types/electron": "~1.4.37", "@types/electron-window-state": "^2.0.28", "@types/loglevel": "^1.4.29", - "@types/menubar": "^5.1.3", - "@types/mousetrap": "^1.5.33", - "@types/node": "^7.0.18", - "browserify": "^14.3.0", - "electron-packager": "^8.7.0", + "@types/mousetrap": "^1.5.34", + "@types/node": "^8.0.0", + "browserify": "^14.4.0", + "electron-packager": "^8.7.1", "npm-run-all": "^4.0.2", - "tslint": "^5.2.0", - "typescript": "^2.3.2" + "tslint": "^5.4.3", + "typescript": "^2.3.4" }, "dependencies": { - "electron": "^1.6.8-beta", + "electron": "1.6.8", "electron-window-state": "^4.1.1", - "electron-context-menu": "^0.9.0", + "electron-context-menu": "^0.9.1", "loglevel": "^1.4.1", "menubar": "github:rhysd/menubar#mstdn", "mousetrap": "^1.6.1" diff --git a/typings/menubar.d.ts b/typings/menubar.d.ts new file mode 100644 index 0000000..0c385a0 --- /dev/null +++ b/typings/menubar.d.ts @@ -0,0 +1,55 @@ +declare namespace Menubar { + type Position + = "trayLeft" + | "trayBottomLeft" + | "trayRight" + | "trayBottomRight" + | "trayCenter" + | "trayBottomCenter" + | "topLeft" + | "topRight" + | "bottomLeft" + | "bottomRight" + | "topCenter" + | "bottomCenter" + | "center"; + type TrayBounds + = "trayLeft" + | "trayBottomLeft" + | "trayRight" + | "trayBottomRight" + | "trayCenter" + | "trayBottomCenter"; + interface ElectronPositioner { + move(pos: Position): void; + calculate(pos: Position, bounds?: TrayBounds): Electron.Point; + } + class MenubarApp extends NodeJS.EventEmitter { + app: Electron.App; + window: Electron.BrowserWindow; + tray: Electron.Tray; + positioner: ElectronPositioner; + + setOption(opt: string, value: any): void; + getOption(opt: string): any; + showWindow(): void; + hideWindow(): void; + } + interface MenubarOptions extends Electron.BrowserWindowOptions { + dir?: string; + index?: string; + tooltip?: string; + tray?: Electron.Tray; + preloadWindow?: boolean; + alwaysOnTop?: boolean; + showOnAllWorkspaces?: boolean; + windowPosition?: Position; + showDockIcon?: boolean; + showOnRightClick?: boolean; + } +} + +declare module "menubar" { + const ctor: (opts?: Menubar.MenubarOptions) => Menubar.MenubarApp; + export = ctor; +}