Deprecate client.send()

Summary:
Adds a warning when not in production and client.send() is used.

We could just delete it but there may be open source users of the API.

Reviewed By: passy

Differential Revision: D14085002

fbshipit-source-id: 39f965b59540bd5b7059ec8d6b1c274146699d2d
This commit is contained in:
John Knox
2019-02-14 09:50:55 -08:00
committed by Facebook Github Bot
parent 2a938c5b81
commit d95e81b17d

View File

@@ -454,6 +454,12 @@ export default class Client extends EventEmitter {
} }
send(api: string, method: string, params?: Object): void { send(api: string, method: string, params?: Object): void {
if (!isProduction()) {
console.warn(
`${api}:${method ||
''} client.send() is deprecated. Please use call() instead so you can handle errors.`,
);
}
return this.rawSend('execute', {api, method, params}); return this.rawSend('execute', {api, method, params});
} }
} }