Pass supportsMethod as an argument to the exportPersistedState

Summary:
This diff adds supportsMethod as a closure which can be used to verify a method is implemented on the client side.

It will be used in the next diff

Reviewed By: jknoxville

Differential Revision: D21176415

fbshipit-source-id: fe16d966c58d36558034ce4ade8f58f8031aab18
This commit is contained in:
Pritesh Nandgaonkar
2020-04-23 04:29:24 -07:00
committed by Facebook GitHub Bot
parent 3a95875f67
commit 9d0d900b05
3 changed files with 13 additions and 0 deletions

View File

@@ -31,6 +31,15 @@ export function callClient(
return (method, params) => client.call(id, method, false, params);
}
// This function is intended to be called from outside of the plugin.
// If you want to `supportsMethod` from the plugin use, this.client.supportsMethod
export function supportsMethod(
client: Client,
id: string,
): (method: string) => Promise<boolean> {
return (method) => client.supportsMethod(id, method);
}
export interface PluginClient {
// eslint-disable-next-line
send(method: string, params?: Parameters): void;
@@ -109,6 +118,7 @@ export abstract class FlipperBasePlugin<
store: ReduxState | undefined,
idler?: Idler,
statusUpdate?: (msg: string) => void,
supportsMethod?: (method: string) => Promise<boolean>,
) => Promise<StaticPersistedState | undefined>)
| null;
static getActiveNotifications: