Skip to content

Commit

Permalink
domain: eol deprecate MakeCallback with domain property
Browse files Browse the repository at this point in the history
  • Loading branch information
RedYetiDev committed Sep 20, 2024
1 parent 8b8fc53 commit c966a22
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 102 deletions.
5 changes: 4 additions & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2087,12 +2087,15 @@ Type: Runtime

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/55034
description: End-of-Life.
- version: v10.0.0
pr-url: https://github.com/nodejs/node/pull/17417
description: Runtime deprecation.
-->

Type: Runtime
Type: End-of-Life

Users of `MakeCallback` that add the `domain` property to carry context,
should start using the `async_context` variant of `MakeCallback` or
Expand Down
17 changes: 0 additions & 17 deletions lib/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,8 @@ process.setUncaughtExceptionCaptureCallback = function(fn) {
throw err;
};


let sendMakeCallbackDeprecation = false;
function emitMakeCallbackDeprecation({ target, method }) {
if (!sendMakeCallbackDeprecation) {
process.emitWarning(
'Using a domain property in MakeCallback is deprecated. Use the ' +
'async_context variant of MakeCallback or the AsyncResource class ' +
'instead. ' +
`(Triggered by calling ${method?.name || '<anonymous>'} ` +
`on ${target?.constructor?.name}.)`,
'DeprecationWarning', 'DEP0097');
sendMakeCallbackDeprecation = true;
}
}

function topLevelDomainCallback(cb, ...args) {
const domain = this.domain;
if (exports.active && domain)
emitMakeCallbackDeprecation({ target: this, method: cb });

if (domain)
domain.enter();
Expand Down
32 changes: 0 additions & 32 deletions test/addons/make-callback-domain-warning/binding.cc

This file was deleted.

9 changes: 0 additions & 9 deletions test/addons/make-callback-domain-warning/binding.gyp

This file was deleted.

43 changes: 0 additions & 43 deletions test/addons/make-callback-domain-warning/test.js

This file was deleted.

0 comments on commit c966a22

Please sign in to comment.