Add isMethodSupported to client
Summary: Allows plugins to check if extension commands or new features are enabled in the current app, by calling `this.client.supportsMethod('xxx')`.
Reviewed By: passy
Differential Revision: D14225961
fbshipit-source-id: c9f7f5b3091209f0ce9705d9d3a0ec173edf3e25
This commit is contained in:
committed by
Facebook Github Bot
parent
6dc2215753
commit
0445a05e5b
@@ -469,4 +469,13 @@ export default class Client extends EventEmitter {
|
||||
}
|
||||
return this.rawSend('execute', {api, method, params});
|
||||
}
|
||||
|
||||
supportsMethod(api: string, method: string): Promise<boolean> {
|
||||
if (this.sdkVersion < 2) {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
return this.rawCall('isMethodSupported', {api, method}).then(
|
||||
response => response.isSupported,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user