Implement receiving messages from add-on on the client

Reviewed By: mweststrate

Differential Revision: D34249101

fbshipit-source-id: 07297b84ed8640e3b41599726ba613b6b4e2b62e
This commit is contained in:
Andrey Goncharov
2022-02-28 03:50:34 -08:00
committed by Facebook GitHub Bot
parent 4067f5bd88
commit b4b9c0ab28
8 changed files with 114 additions and 38 deletions

View File

@@ -21,6 +21,17 @@ export interface ServerAddOnControls {
method: string,
params?: unknown,
) => Promise<object | string | number | boolean | null>;
receiveMessage: (
pluginName: string,
method: string,
receiver: (data: unknown) => void,
) => void;
receiveAnyMessage: (
pluginName: string,
receiver: (method: string, data: unknown) => void,
) => void;
unsubscribePlugin: (pluginName: string) => void;
unsubscribe: () => void;
}
// TODO: Share with js-flipper? Is it worth it?