Client fixes
Summary: Event emitter was typed any. Therefore, Client extended any and thing went south. removing the explicit any type and fixing flow errors. Reviewed By: jknoxville Differential Revision: D15987630 fbshipit-source-id: 9456149d46f839d9579fcc2671ab2a82935fc23a
This commit is contained in:
committed by
Facebook Github Bot
parent
1a0ee24b1a
commit
468468a3bc
@@ -22,7 +22,7 @@ import {default as isProduction} from './utils/isProduction.js';
|
|||||||
import {registerPlugins} from './reducers/plugins';
|
import {registerPlugins} from './reducers/plugins';
|
||||||
import createTableNativePlugin from './plugins/TableNativePlugin';
|
import createTableNativePlugin from './plugins/TableNativePlugin';
|
||||||
|
|
||||||
const EventEmitter = (require('events'): any);
|
const EventEmitter = require('events');
|
||||||
const invariant = require('invariant');
|
const invariant = require('invariant');
|
||||||
|
|
||||||
type Plugins = Array<string>;
|
type Plugins = Array<string>;
|
||||||
@@ -196,9 +196,6 @@ export default class Client extends EventEmitter {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
on: ((event: 'plugins-change', callback: () => void) => void) &
|
|
||||||
((event: 'close', callback: () => void) => void);
|
|
||||||
|
|
||||||
app: App;
|
app: App;
|
||||||
connected: boolean;
|
connected: boolean;
|
||||||
id: string;
|
id: string;
|
||||||
@@ -211,7 +208,8 @@ export default class Client extends EventEmitter {
|
|||||||
store: Store;
|
store: Store;
|
||||||
activePlugins: Set<string>;
|
activePlugins: Set<string>;
|
||||||
device: Promise<BaseDevice>;
|
device: Promise<BaseDevice>;
|
||||||
|
logger: Logger;
|
||||||
|
lastSeenDeviceList: Array<BaseDevice>;
|
||||||
broadcastCallbacks: Map<?string, Map<string, Set<Function>>>;
|
broadcastCallbacks: Map<?string, Map<string, Set<Function>>>;
|
||||||
|
|
||||||
requestCallbacks: Map<
|
requestCallbacks: Map<
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {performance} from 'perf_hooks';
|
|||||||
|
|
||||||
import type {Store} from '../reducers/index.js';
|
import type {Store} from '../reducers/index.js';
|
||||||
import type {Logger} from '../fb-interfaces/Logger.js';
|
import type {Logger} from '../fb-interfaces/Logger.js';
|
||||||
|
import type Client from '../Client';
|
||||||
|
|
||||||
export default (store: Store, logger: Logger) => {
|
export default (store: Store, logger: Logger) => {
|
||||||
let droppedFrames: number = 0;
|
let droppedFrames: number = 0;
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ export class FlipperDevicePlugin<S = *, A = *, P = *> extends FlipperBasePlugin<
|
|||||||
|
|
||||||
constructor(props: Props<P>) {
|
constructor(props: Props<P>) {
|
||||||
super(props);
|
super(props);
|
||||||
|
// $FlowFixMe props.target will be instance of Device
|
||||||
this.device = props.target;
|
this.device = props.target;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,8 +204,8 @@ export class FlipperPlugin<S = *, A = *, P = *> extends FlipperBasePlugin<
|
|||||||
client: PluginClient;
|
client: PluginClient;
|
||||||
realClient: Client;
|
realClient: Client;
|
||||||
|
|
||||||
getDevice(): ?BaseDevice {
|
getDevice(): Promise<BaseDevice> {
|
||||||
return this.realClient.getDevice();
|
return this.realClient.device;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAndroidDevice(): AndroidDevice {
|
getAndroidDevice(): AndroidDevice {
|
||||||
|
|||||||
Reference in New Issue
Block a user