src: deprecate AddPromiseHook()

This API was added to fill an use case that is served by `async_hooks`,
since that has `Promise` support.

Deprecate this, as the underlying `Isolate::SetPromiseHook()` may be
removed in its current form in the future.

Refs: https://docs.google.com/document/d/1g8OrG5lMIUhRn1zbkutgY83MiTSMx-0NHDs8Bf-nXxM/

PR-URL: https://github.com/nodejs/node/pull/26529
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Anna Henningsen 2019-03-08 18:15:49 +01:00
parent 2176d63055
commit 171b2707d3
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -597,9 +597,10 @@ struct async_context {
/* Registers an additional v8::PromiseHook wrapper. This API exists because V8
* itself supports only a single PromiseHook. */
NODE_EXTERN void AddPromiseHook(v8::Isolate* isolate,
promise_hook_func fn,
void* arg);
NODE_DEPRECATED("Use async_hooks directly instead",
NODE_EXTERN void AddPromiseHook(v8::Isolate* isolate,
promise_hook_func fn,
void* arg));
/* This is a lot like node::AtExit, except that the hooks added via this
* function are run before the AtExit ones and will always be registered