Track 'reload' usage
Summary: Keep track of how often the 'reload' command is used Reviewed By: passy Differential Revision: D21227851 fbshipit-source-id: 112781024be16e411e93cf2403f95b2f3134d971
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d142369e9d
commit
df88bbb7db
@@ -25,6 +25,7 @@ import {Store} from './reducers/';
|
|||||||
import electron, {MenuItemConstructorOptions} from 'electron';
|
import electron, {MenuItemConstructorOptions} from 'electron';
|
||||||
import {notNull} from './utils/typeUtils';
|
import {notNull} from './utils/typeUtils';
|
||||||
import constants from './fb-stubs/constants';
|
import constants from './fb-stubs/constants';
|
||||||
|
import {Logger} from './fb-interfaces/Logger';
|
||||||
|
|
||||||
export type DefaultKeyboardAction = 'clear' | 'goToBottom' | 'createPaste';
|
export type DefaultKeyboardAction = 'clear' | 'goToBottom' | 'createPaste';
|
||||||
export type TopLevelMenu = 'Edit' | 'View' | 'Window' | 'Help';
|
export type TopLevelMenu = 'Edit' | 'View' | 'Window' | 'Help';
|
||||||
@@ -72,11 +73,13 @@ function actionHandler(action: string) {
|
|||||||
export function setupMenuBar(
|
export function setupMenuBar(
|
||||||
plugins: Array<typeof FlipperPlugin | typeof FlipperDevicePlugin>,
|
plugins: Array<typeof FlipperPlugin | typeof FlipperDevicePlugin>,
|
||||||
store: Store,
|
store: Store,
|
||||||
|
logger: Logger,
|
||||||
) {
|
) {
|
||||||
const template = getTemplate(
|
const template = getTemplate(
|
||||||
electron.remote.app,
|
electron.remote.app,
|
||||||
electron.remote.shell,
|
electron.remote.shell,
|
||||||
store,
|
store,
|
||||||
|
logger,
|
||||||
);
|
);
|
||||||
// collect all keyboard actions from all plugins
|
// collect all keyboard actions from all plugins
|
||||||
const registeredActions: Set<KeyboardAction> = new Set(
|
const registeredActions: Set<KeyboardAction> = new Set(
|
||||||
@@ -184,6 +187,7 @@ function getTemplate(
|
|||||||
app: electron.App,
|
app: electron.App,
|
||||||
shell: electron.Shell,
|
shell: electron.Shell,
|
||||||
store: Store,
|
store: Store,
|
||||||
|
logger: Logger,
|
||||||
): Array<MenuItemConstructorOptions> {
|
): Array<MenuItemConstructorOptions> {
|
||||||
const exportSubmenu = [
|
const exportSubmenu = [
|
||||||
{
|
{
|
||||||
@@ -285,6 +289,7 @@ function getTemplate(
|
|||||||
focusedWindow: electron.BrowserWindow | undefined,
|
focusedWindow: electron.BrowserWindow | undefined,
|
||||||
) {
|
) {
|
||||||
if (focusedWindow) {
|
if (focusedWindow) {
|
||||||
|
logger.track('usage', 'reload');
|
||||||
focusedWindow.reload();
|
focusedWindow.reload();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export type PluginDefinition = {
|
|||||||
entry?: string;
|
entry?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (store: Store, _logger: Logger) => {
|
export default (store: Store, logger: Logger) => {
|
||||||
// expose Flipper and exact globally for dynamically loaded plugins
|
// expose Flipper and exact globally for dynamically loaded plugins
|
||||||
const globalObject: any = typeof window === 'undefined' ? global : window;
|
const globalObject: any = typeof window === 'undefined' ? global : window;
|
||||||
globalObject.React = React;
|
globalObject.React = React;
|
||||||
@@ -74,6 +74,7 @@ export default (store: Store, _logger: Logger) => {
|
|||||||
setupMenuBar(
|
setupMenuBar(
|
||||||
[...plugins.devicePlugins.values(), ...plugins.clientPlugins.values()],
|
[...plugins.devicePlugins.values(), ...plugins.clientPlugins.values()],
|
||||||
store,
|
store,
|
||||||
|
logger,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user