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 {notNull} from './utils/typeUtils';
|
||||
import constants from './fb-stubs/constants';
|
||||
import {Logger} from './fb-interfaces/Logger';
|
||||
|
||||
export type DefaultKeyboardAction = 'clear' | 'goToBottom' | 'createPaste';
|
||||
export type TopLevelMenu = 'Edit' | 'View' | 'Window' | 'Help';
|
||||
@@ -72,11 +73,13 @@ function actionHandler(action: string) {
|
||||
export function setupMenuBar(
|
||||
plugins: Array<typeof FlipperPlugin | typeof FlipperDevicePlugin>,
|
||||
store: Store,
|
||||
logger: Logger,
|
||||
) {
|
||||
const template = getTemplate(
|
||||
electron.remote.app,
|
||||
electron.remote.shell,
|
||||
store,
|
||||
logger,
|
||||
);
|
||||
// collect all keyboard actions from all plugins
|
||||
const registeredActions: Set<KeyboardAction> = new Set(
|
||||
@@ -184,6 +187,7 @@ function getTemplate(
|
||||
app: electron.App,
|
||||
shell: electron.Shell,
|
||||
store: Store,
|
||||
logger: Logger,
|
||||
): Array<MenuItemConstructorOptions> {
|
||||
const exportSubmenu = [
|
||||
{
|
||||
@@ -285,6 +289,7 @@ function getTemplate(
|
||||
focusedWindow: electron.BrowserWindow | undefined,
|
||||
) {
|
||||
if (focusedWindow) {
|
||||
logger.track('usage', 'reload');
|
||||
focusedWindow.reload();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -41,7 +41,7 @@ export type PluginDefinition = {
|
||||
entry?: string;
|
||||
};
|
||||
|
||||
export default (store: Store, _logger: Logger) => {
|
||||
export default (store: Store, logger: Logger) => {
|
||||
// expose Flipper and exact globally for dynamically loaded plugins
|
||||
const globalObject: any = typeof window === 'undefined' ? global : window;
|
||||
globalObject.React = React;
|
||||
@@ -74,6 +74,7 @@ export default (store: Store, _logger: Logger) => {
|
||||
setupMenuBar(
|
||||
[...plugins.devicePlugins.values(), ...plugins.clientPlugins.values()],
|
||||
store,
|
||||
logger,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user