Limit methods server add on can access
Reviewed By: mweststrate Differential Revision: D34076174 fbshipit-source-id: e51a1b08dab54de6b7dc82ca59ec18a10f81ddd7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b80755721c
commit
b9294645d3
@@ -13,12 +13,15 @@ import {
|
||||
ServerAddOnDesktopToModuleConnection,
|
||||
FlipperServerForServerAddOn,
|
||||
} from './ServerAddOnDesktopToModuleConnection';
|
||||
import {ServerAddOnModuleToDesktopConnection} from './ServerAddOnModuleToDesktopConnection';
|
||||
import {
|
||||
ServerAddOnModuleToDesktopConnection,
|
||||
ServerAddOnPluginConnection,
|
||||
} from './ServerAddOnModuleToDesktopConnection';
|
||||
|
||||
type ServerAddOnCleanup = () => Promise<void>;
|
||||
interface ServerAddOnModule {
|
||||
serverAddOn?: (
|
||||
connection: ServerAddOnModuleToDesktopConnection,
|
||||
connection: ServerAddOnPluginConnection,
|
||||
{flipperServer}: {flipperServer: FlipperServerForServerAddOn},
|
||||
) => Promise<ServerAddOnCleanup>;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,15 @@ export type ServerAddOnModuleToDesktopConnectionEvents = {
|
||||
message: ExecuteMessage;
|
||||
};
|
||||
|
||||
export class ServerAddOnModuleToDesktopConnection extends EventEmitter {
|
||||
export interface ServerAddOnPluginConnection {
|
||||
send(method: string, params: unknown): void;
|
||||
receive(method: string, receiver: FlipperPluginReceiver): void;
|
||||
}
|
||||
|
||||
export class ServerAddOnModuleToDesktopConnection
|
||||
extends EventEmitter
|
||||
implements ServerAddOnPluginConnection
|
||||
{
|
||||
private subscriptions: Map<string, FlipperPluginReceiver> = new Map();
|
||||
|
||||
send(method: string, params: unknown) {
|
||||
|
||||
Reference in New Issue
Block a user