7

I have read many threads related to this but they are a little bit old now, that's why as Domain is still Deprecated till now has anyone found any other good alternative to using Domain or not ??

I read this post alternative-to-domain-in-nodejs and there i found zone.js, does anybody use it as domain alternative or not ?? Because as the last commit on this library was 3 years ago that's why I don't think it will be a reliable solution ??

Sudhanshu Gaur
  • 7,486
  • 9
  • 47
  • 94

2 Answers2

4

Domain isn't deprecated yet, it's pending deprecation; it won't be propery deprecated until there's a replacement. From the documentation:

This module is pending deprecation. Once a replacement API has been finalized, this module will be fully deprecated. Most end users should not have cause to use this module. Users who absolutely must have the functionality that domains provide may rely on it for the time being but should expect to have to migrate to a different solution in the future.

Note that last bit:

Users who absolutely must have the functionality that domains provide may rely on it for the time being...

So in terms of a replacement: Watch that page. The new API will be announced and the deprecation notice updated, presumably.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
1

zone.js now move to angular package, you can found it here, https://github.com/angular/angular/tree/main/packages/zone.js.

And it can work in node.js, you can find detailed information here.

https://github.com/angular/angular/blob/main/packages/zone.js/MODULE.md https://github.com/angular/angular/blob/main/packages/zone.js/NON-STANDARD-APIS.md

you can try the new version, zone.js provide some features that domain doesn't have. please tell me when you need more information.

svarog
  • 9,477
  • 4
  • 61
  • 77
jiali passion
  • 1,691
  • 1
  • 14
  • 19