electron flow type definitions
Summary: Adding a flowtype library definition for electron 3 and fixing related type errors Reviewed By: passy Differential Revision: D9124758 fbshipit-source-id: e09cb5b05ba952e7f95f68f9043edc586f81ae83
This commit is contained in:
committed by
Facebook Github Bot
parent
69eaedcbb0
commit
75dfbf51f8
3745
flow-typed/npm/electron-v3.0.0-beta.4.js
vendored
Normal file
3745
flow-typed/npm/electron-v3.0.0-beta.4.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
59
flow-typed/npm/electron_vx.x.x.js
vendored
59
flow-typed/npm/electron_vx.x.x.js
vendored
@@ -1,59 +0,0 @@
|
|||||||
// flow-typed signature: 451c88326bb7cc6aa79491d34e1c60b0
|
|
||||||
// flow-typed version: <<STUB>>/electron_v1.7.3/flow_v0.59.0
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is an autogenerated libdef stub for:
|
|
||||||
*
|
|
||||||
* 'electron'
|
|
||||||
*
|
|
||||||
* Fill this stub out by replacing all the `any` types.
|
|
||||||
*
|
|
||||||
* Once filled out, we encourage you to share your work with the
|
|
||||||
* community by sending a pull request to:
|
|
||||||
* https://github.com/flowtype/flow-typed
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare module 'electron' {
|
|
||||||
declare module.exports: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We include stubs for each file inside this npm package in case you need to
|
|
||||||
* require those files directly. Feel free to delete any files that aren't
|
|
||||||
* needed.
|
|
||||||
*/
|
|
||||||
declare module 'electron/cli' {
|
|
||||||
declare module.exports: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'electron/install' {
|
|
||||||
declare module.exports: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'electron/test/errors' {
|
|
||||||
declare module.exports: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'electron/test/index' {
|
|
||||||
declare module.exports: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filename aliases
|
|
||||||
declare module 'electron/cli.js' {
|
|
||||||
declare module.exports: $Exports<'electron/cli'>;
|
|
||||||
}
|
|
||||||
declare module 'electron/index' {
|
|
||||||
declare module.exports: $Exports<'electron'>;
|
|
||||||
}
|
|
||||||
declare module 'electron/index.js' {
|
|
||||||
declare module.exports: $Exports<'electron'>;
|
|
||||||
}
|
|
||||||
declare module 'electron/install.js' {
|
|
||||||
declare module.exports: $Exports<'electron/install'>;
|
|
||||||
}
|
|
||||||
declare module 'electron/test/errors.js' {
|
|
||||||
declare module.exports: $Exports<'electron/test/errors'>;
|
|
||||||
}
|
|
||||||
declare module 'electron/test/index.js' {
|
|
||||||
declare module.exports: $Exports<'electron/test/index'>;
|
|
||||||
}
|
|
||||||
@@ -97,11 +97,14 @@ export function setupMenuBar() {
|
|||||||
const menu = applicationMenu.items.find(
|
const menu = applicationMenu.items.find(
|
||||||
menuItem => menuItem.label === topLevelMenu,
|
menuItem => menuItem.label === topLevelMenu,
|
||||||
);
|
);
|
||||||
|
if (menu) {
|
||||||
|
// $FlowFixMe submenu is missing in electron API spec
|
||||||
const menuItem = menu.submenu.items.find(
|
const menuItem = menu.submenu.items.find(
|
||||||
menuItem => menuItem.label === label,
|
menuItem => menuItem.label === label,
|
||||||
);
|
);
|
||||||
menuItems.set(action, menuItem);
|
menuItems.set(action, menuItem);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// update menubar
|
// update menubar
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ export default class AutoUpdateVersion extends Component<{}, State> {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (isProduction()) {
|
if (isProduction()) {
|
||||||
remote.autoUpdater.setFeedURL(
|
remote.autoUpdater.setFeedURL({
|
||||||
`${config.updateServer}?version=${version}`,
|
url: `${config.updateServer}?version=${version}`,
|
||||||
);
|
});
|
||||||
|
|
||||||
remote.autoUpdater.on('update-downloaded', () => {
|
remote.autoUpdater.on('update-downloaded', () => {
|
||||||
this.setState({updater: 'update-downloaded'});
|
this.setState({updater: 'update-downloaded'});
|
||||||
|
|||||||
@@ -11,16 +11,16 @@ import type Logger from '../fb-stubs/Logger.js';
|
|||||||
|
|
||||||
export default (store: Store, logger: Logger) => {
|
export default (store: Store, logger: Logger) => {
|
||||||
const currentWindow = remote.getCurrentWindow();
|
const currentWindow = remote.getCurrentWindow();
|
||||||
currentWindow.on('focus', () =>
|
currentWindow.on('focus', () => {
|
||||||
store.dispatch({
|
store.dispatch({
|
||||||
type: 'windowIsFocused',
|
type: 'windowIsFocused',
|
||||||
payload: true,
|
payload: true,
|
||||||
}),
|
});
|
||||||
);
|
});
|
||||||
currentWindow.on('blur', () =>
|
currentWindow.on('blur', () => {
|
||||||
store.dispatch({
|
store.dispatch({
|
||||||
type: 'windowIsFocused',
|
type: 'windowIsFocused',
|
||||||
payload: false,
|
payload: false,
|
||||||
}),
|
});
|
||||||
);
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -281,7 +281,8 @@ class Button extends styled.StylableComponent<
|
|||||||
position.x = parseInt(left, 10);
|
position.x = parseInt(left, 10);
|
||||||
position.y = parseInt(bottom + 6, 10);
|
position.y = parseInt(bottom + 6, 10);
|
||||||
}
|
}
|
||||||
menu.popup(electron.remote.getCurrentWindow(), {
|
menu.popup({
|
||||||
|
window: electron.remote.getCurrentWindow(),
|
||||||
async: true,
|
async: true,
|
||||||
...position,
|
...position,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export default class ContextMenuProvider extends Component<{|
|
|||||||
onContextMenu = () => {
|
onContextMenu = () => {
|
||||||
const menu = electron.remote.Menu.buildFromTemplate(this._menuTemplate);
|
const menu = electron.remote.Menu.buildFromTemplate(this._menuTemplate);
|
||||||
this._menuTemplate = [];
|
this._menuTemplate = [];
|
||||||
menu.popup(electron.remote.getCurrentWindow(), {async: true});
|
menu.popup({window: electron.remote.getCurrentWindow(), async: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ export default class FilterToken extends PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
const menu = electron.remote.Menu.buildFromTemplate(menuTemplate);
|
const menu = electron.remote.Menu.buildFromTemplate(menuTemplate);
|
||||||
const {bottom, left} = this._ref ? this._ref.getBoundingClientRect() : {};
|
const {bottom, left} = this._ref ? this._ref.getBoundingClientRect() : {};
|
||||||
menu.popup(electron.remote.getCurrentWindow(), {
|
menu.popup({
|
||||||
|
window: electron.remote.getCurrentWindow(),
|
||||||
async: true,
|
async: true,
|
||||||
x: parseInt(left, 10),
|
x: parseInt(left, 10),
|
||||||
y: parseInt(bottom, 10) + 8,
|
y: parseInt(bottom, 10) + 8,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
import electron from 'electron';
|
import electron from 'electron';
|
||||||
|
|
||||||
const _isProduction = !/node_modules[\\/]electron[\\/]/.test(
|
const _isProduction = !/node_modules[\\/]electron[\\/]/.test(
|
||||||
|
// $FlowFixMe: execPath exists, but is not in electron API spec
|
||||||
electron.remote.process.execPath,
|
electron.remote.process.execPath,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user