diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index c18c9d58e0b521..ae7c343c6c4ec7 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -892,6 +892,15 @@ Use [`asyncResource.runInAsyncScope()`][] API instead which provides a much safer, and more convenient, alternative. See https://github.com/nodejs/node/pull/18513 for more details. + +### DEP0099: async context-unaware node::MakeCallback C++ APIs + +Type: Compile-time + +Certain versions of `node::MakeCallback` APIs available to native modules are +deprecated. Please use the versions of the API that accept an `async_context` +parameter. + [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array diff --git a/src/node.h b/src/node.h index 89dbdfc727b0c5..cb4346893014ef 100644 --- a/src/node.h +++ b/src/node.h @@ -151,27 +151,30 @@ inline v8::Local UVException(int errorno, * These methods need to be called in a HandleScope. * * It is preferred that you use the `MakeCallback` overloads taking - * `async_id` arguments. + * `async_context` arguments. */ -NODE_EXTERN v8::Local MakeCallback( - v8::Isolate* isolate, - v8::Local recv, - const char* method, - int argc, - v8::Local* argv); -NODE_EXTERN v8::Local MakeCallback( - v8::Isolate* isolate, - v8::Local recv, - v8::Local symbol, - int argc, - v8::Local* argv); -NODE_EXTERN v8::Local MakeCallback( - v8::Isolate* isolate, - v8::Local recv, - v8::Local callback, - int argc, - v8::Local* argv); +NODE_DEPRECATED("Use MakeCallback(..., async_context)", + NODE_EXTERN v8::Local MakeCallback( + v8::Isolate* isolate, + v8::Local recv, + const char* method, + int argc, + v8::Local* argv)); +NODE_DEPRECATED("Use MakeCallback(..., async_context)", + NODE_EXTERN v8::Local MakeCallback( + v8::Isolate* isolate, + v8::Local recv, + v8::Local symbol, + int argc, + v8::Local* argv)); +NODE_DEPRECATED("Use MakeCallback(..., async_context)", + NODE_EXTERN v8::Local MakeCallback( + v8::Isolate* isolate, + v8::Local recv, + v8::Local callback, + int argc, + v8::Local* argv)); } // namespace node