index.js 618 B

12345678910111213141516171819202122
  1. Object.defineProperty(exports, '__esModule', { value: true });
  2. const nodeVersion = require('../nodeVersion.js');
  3. const domain = require('./domain.js');
  4. const hooks = require('./hooks.js');
  5. /**
  6. * Sets the correct async context strategy for Node.js
  7. *
  8. * Node.js >= 14 uses AsyncLocalStorage
  9. * Node.js < 14 uses domains
  10. */
  11. function setNodeAsyncContextStrategy() {
  12. if (nodeVersion.NODE_VERSION.major >= 14) {
  13. hooks.setHooksAsyncContextStrategy();
  14. } else {
  15. domain.setDomainAsyncContextStrategy();
  16. }
  17. }
  18. exports.setNodeAsyncContextStrategy = setNodeAsyncContextStrategy;
  19. //# sourceMappingURL=index.js.map