diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-07-18 15:07:37 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-08-15 17:39:38 +0200 |
| commit | 71592249b2dd669b6f24f37bfb7b0f4e43b74998 (patch) | |
| tree | a6097dc7e5d94d06e99c65fdfe160e824395f50c /flow-libs | |
| parent | e84e87f4ce5a8c242f756566cdc6fb59a45f7bea (diff) | |
| download | mullvadvpn-71592249b2dd669b6f24f37bfb7b0f4e43b74998.tar.xz mullvadvpn-71592249b2dd669b6f24f37bfb7b0f4e43b74998.zip | |
Add workspaces
Diffstat (limited to 'flow-libs')
| -rw-r--r-- | flow-libs/electron.js.flow | 223 | ||||
| -rw-r--r-- | flow-libs/notification.js.flow | 51 | ||||
| -rw-r--r-- | flow-libs/tests.js.flow | 12 |
3 files changed, 0 insertions, 286 deletions
diff --git a/flow-libs/electron.js.flow b/flow-libs/electron.js.flow deleted file mode 100644 index b0facb6c7e..0000000000 --- a/flow-libs/electron.js.flow +++ /dev/null @@ -1,223 +0,0 @@ -// @flow - -import EventEmitter from 'events'; - -declare var process: Process & { - resourcesPath: string; - type: "browser" | "renderer"; - versions: { - electron: string; - chrome: string; - }; -}; - -declare module 'electron' { - - // common types - - declare type Size = { - width: number; - height: number; - } - - declare type Rectangle = { - width: number; - height: number; - x: number; - y: number; - } - - declare type Point = { - x: number; - y: number; - } - - // http://electron.atom.io/docs/api/app - - declare class App extends EventEmitter { - getPath(name: string): string; - setPath(name: string, path: string): void; - quit(): void; - } - - // http://electron.atom.io/docs/api/shell - declare type OpenExternalOptions = { - activate: boolean; - } - - declare class Shell { - showItemInFolder(fullPath: string): boolean; - openItem(fullPath: string): boolean; - openExternal(url: string, options?: OpenExternalOptions, callback?: (error: Error) => void): boolean; - moveItemToTrash(fullPath: string): boolean; - beep(): void; - } - - // http://electron.atom.io/docs/api/remote - - declare class Remote { - app: App; - getCurrentWindow(): BrowserWindow; - getCurrentWebContents(): WebContents; - getGlobal(name: string): ?mixed; - } - - // http://electron.atom.io/docs/api/clipboard - - declare class Clipboard { - writeText(text: string, type?: string): void; - } - - // http://electron.atom.io/docs/api/native-image - - declare class NativeImage { - isEmpty(): boolean; - getSize(): Size; - } - - // http://electron.atom.io/docs/api/tray - - declare class Tray extends EventEmitter { - constructor(image: NativeImage | string): void; - getBounds(): Rectangle; - setHighlightMode(mode: 'selection' | 'always' | 'never'): void; - setImage(image: NativeImage | string): void; - setPressedImage(image: NativeImage | string): void; - } - - // https://electronjs.org/docs/api/screen - - declare type Display = { - id: number; - rotation: number; - scaleFactor: number; - touchSupport: 'available' | 'unavailable' | 'unknown'; - bounds: Rectangle; - size: Size; - workArea: Rectangle; - workAreaSize: Size; - } - - declare class Screen extends EventEmitter { - getCursorScreenPoint(): Point; - getPrimaryDisplay(): Display; - getAllDisplays(): Array<Display>; - getDisplayNearestPoint(point: Point): Display; - getDisplayMatching(rect: Rectangle): Display; - } - - // http://electron.atom.io/docs/api/web-frame - - declare class WebFrame extends EventEmitter { - setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - } - - // http://electron.atom.io/docs/api/ipc-renderer - - declare class IpcRenderer extends EventEmitter { - send(channel: string, ...args: Array<mixed>): void; - } - - // http://electron.atom.io/docs/api/ipc-main - - declare class IpcMain extends EventEmitter {} - - declare class WebContents extends EventEmitter { - send(channel: string, ...args: Array<mixed>): void; - } - - // http://electron.atom.io/docs/api/browser-window - - declare type OpenDevToolsOptions = { - mode: 'right' | 'bottom' | 'undocked' | 'detach'; - } - - declare type WebPreferences = { - backgroundThrottling?: boolean; - scrollBounce?: boolean; - blinkFeatures?: string; - disableBlinkFeatures?: string; - } - - declare type BrowserWindowConstructorOptions = { - width?: number; - height?: number; - resizable?: boolean; - maximizable?: boolean; - fullscreenable?: boolean; - show?: boolean; - frame?: boolean; - transparent?: boolean; - webPreferences?: WebPreferences; - } - - declare type LoadURLOptions = { - userAgent?: string; - } - - declare class BrowserWindow extends EventEmitter { - constructor(options: ?BrowserWindowConstructorOptions): this; - isVisible(): boolean; - show(): void; - hide(): void; - focus(): void; - setPosition(x: number, y: number, animate?: boolean): void; - getBounds(): Rectangle; - setVisibleOnAllWorkspaces(visible: boolean): void; - isVisibleOnAllWorkspaces(): boolean; - inspectElement(x: number, y: number): void; - isDevToolsOpened(): boolean;isDevToolsOpened(): boolean; - openDevTools(options?: OpenDevToolsOptions): void; - closeDevTools(): void; - loadURL(url: string, options?: LoadURLOptions): void; - webContents: WebContents; - } - - // http://electron.atom.io/docs/api/menu-item - declare class MenuItem {} - - // http://electron.atom.io/docs/api/menu - - declare type MenuItemConstructorOptions = { - type?: 'normal' | 'separator' | 'submenu' | 'checkbox' | 'radio'; - label?: string; - role?: string; - click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void; - } - - declare type PopupOptions = { - x?: number; - y?: number; - } - - declare class Menu { - static buildFromTemplate(template: Array<MenuItemConstructorOptions>): Menu; - static setApplicationMenu(menu: Menu): void; - popup(browserWindow?: BrowserWindow, options?: PopupOptions): void; - } - - // http://electron.atom.io/docs/api/app - - declare class App extends EventEmitter { - setPath(name: string, path: string): void; - getPath(name: string): string; - quit(): void; - } - - // MainInterface - - declare var nativeImage: { - createEmpty(): NativeImage, - createFromPath(path: string): NativeImage, - createFromBuffer(buffer: Buffer, scaleFactor?: number): NativeImage, - createFromDataURL(dataURL: string): NativeImage - }; - declare var webFrame: WebFrame; - declare var app: App; - declare var ipcRenderer: IpcRenderer; - declare var ipcMain: IpcMain; - declare var remote: Remote; - declare var shell: Shell; - declare var clipboard: Clipboard; - declare var screen: Screen; -} diff --git a/flow-libs/notification.js.flow b/flow-libs/notification.js.flow deleted file mode 100644 index bf5dda3af2..0000000000 --- a/flow-libs/notification.js.flow +++ /dev/null @@ -1,51 +0,0 @@ -/* Notification */ -type NotificationPermission = 'default' | 'denied' | 'granted'; -type NotificationDirection = 'auto' | 'ltr' | 'rtl'; -type VibratePattern = number | Array<number>; -type NotificationAction = { action: string, title: string, icon?: string }; -type NotificationOptions = { - dir: NotificationDirection, - lang: string, - body: string, - tag: string, - image: string, - icon: string, - badge: string, - sound: string, - vibrate: VibratePattern, - timestamp: number, - renotify: boolean, - silent: boolean, - requireInteraction: boolean, - data: ?any, - actions: Array<NotificationAction>, -}; - -declare class Notification extends EventTarget { - constructor(title: string, options?: $Shape<NotificationOptions>): void; - static permission: NotificationPermission; - static requestPermission( - callback?: (perm: NotificationPermission) => mixed, - ): Promise<NotificationPermission>; - static maxActions: number; - onclick: (evt: Event) => any; - onerror: (evt: Event) => any; - title: string; - dir: NotificationDirection; - lang: string; - body: string; - tag: string; - image: string; - icon: string; - badge: string; - sound: string; - vibrate: Array<number>; - timestamp: number; - renotify: boolean; - silent: boolean; - requireInteraction: boolean; - data: any; - actions: Array<NotificationAction>; - - close(): void; -} diff --git a/flow-libs/tests.js.flow b/flow-libs/tests.js.flow deleted file mode 100644 index aecc8239fa..0000000000 --- a/flow-libs/tests.js.flow +++ /dev/null @@ -1,12 +0,0 @@ -import chai from 'chai'; - -// We use electron-mocha which has a child dependency on mocha. -// However flow-typed does not automatically pull annotations for mocha. -// These stubs remedy the absence of those. -declare function describe(string, Function): void; -declare function it(string, (done: Function) => any): Promise<any> | void; -declare function afterEach((done: Function) => void): Promise<any> | void; -declare function beforeEach((done: Function) => void): Promise<any> | void; - -declare var expect: $PropertyType<chai, 'expect'>; -declare var spy: any;
\ No newline at end of file |
