Skip to content

Commit

Permalink
src: deprecate AddPromiseHook()
Browse files Browse the repository at this point in the history
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: #26529
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
addaleax authored and BethGriggs committed Apr 16, 2019
1 parent 4285b57 commit 4274542
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,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
Expand Down

0 comments on commit 4274542

Please sign in to comment.