11'use strict' ;
22
33const errors = require ( 'internal/errors' ) ;
4- const internalUtil = require ( 'internal/util' ) ;
54const async_wrap = process . binding ( 'async_wrap' ) ;
65const internal_async_hooks = require ( 'internal/async_hooks' ) ;
76
87// Get functions
9- // Only used to support a deprecated API. pushAsyncIds, popAsyncIds should
10- // never be directly in this manner.
11- const { pushAsyncIds, popAsyncIds } = async_wrap ;
128// For userland AsyncResources, make sure to emit a destroy event when the
139// resource gets gced.
1410const { registerDestroyHook } = async_wrap ;
@@ -17,10 +13,9 @@ const {
1713 getHookArrays,
1814 enableHooks,
1915 disableHooks,
20- // Sensitive Embedder API
16+ // Internal Embedder API
2117 newUid,
2218 initTriggerId,
23- setInitTriggerId,
2419 emitInit,
2520 emitBefore,
2621 emitAfter,
@@ -204,18 +199,6 @@ class AsyncResource {
204199}
205200
206201
207- function runInAsyncIdScope ( asyncId , cb ) {
208- // Store the async id now to make sure the stack is still good when the ids
209- // are popped off the stack.
210- const prevId = executionAsyncId ( ) ;
211- pushAsyncIds ( asyncId , prevId ) ;
212- try {
213- cb ( ) ;
214- } finally {
215- popAsyncIds ( asyncId ) ;
216- }
217- }
218-
219202// Placing all exports down here because the exported classes won't export
220203// otherwise.
221204module . exports = {
@@ -226,61 +209,3 @@ module.exports = {
226209 // Embedder API
227210 AsyncResource,
228211} ;
229-
230- // Deprecated API //
231-
232- Object . defineProperty ( module . exports , 'runInAsyncIdScope' , {
233- get : internalUtil . deprecate ( function ( ) {
234- return runInAsyncIdScope ;
235- } , 'async_hooks.runInAsyncIdScope is deprecated. ' +
236- 'Create an AsyncResource instead.' , 'DEP0086' )
237- } ) ;
238-
239- Object . defineProperty ( module . exports , 'newUid' , {
240- get : internalUtil . deprecate ( function ( ) {
241- return newUid ;
242- } , 'async_hooks.newUid is deprecated. ' +
243- 'Use AsyncResource instead.' , 'DEP0085' )
244- } ) ;
245-
246- Object . defineProperty ( module . exports , 'initTriggerId' , {
247- get : internalUtil . deprecate ( function ( ) {
248- return initTriggerId ;
249- } , 'async_hooks.initTriggerId is deprecated. ' +
250- 'Use the AsyncResource default instead.' , 'DEP0085' )
251- } ) ;
252-
253- Object . defineProperty ( module . exports , 'setInitTriggerId' , {
254- get : internalUtil . deprecate ( function ( ) {
255- return setInitTriggerId ;
256- } , 'async_hooks.setInitTriggerId is deprecated. ' +
257- 'Use the triggerAsyncId parameter in AsyncResource instead.' , 'DEP0085' )
258- } ) ;
259-
260- Object . defineProperty ( module . exports , 'emitInit' , {
261- get : internalUtil . deprecate ( function ( ) {
262- return emitInit ;
263- } , 'async_hooks.emitInit is deprecated. ' +
264- 'Use AsyncResource constructor instead.' , 'DEP0085' )
265- } ) ;
266-
267- Object . defineProperty ( module . exports , 'emitBefore' , {
268- get : internalUtil . deprecate ( function ( ) {
269- return emitBefore ;
270- } , 'async_hooks.emitBefore is deprecated. ' +
271- 'Use AsyncResource.emitBefore instead.' , 'DEP0085' )
272- } ) ;
273-
274- Object . defineProperty ( module . exports , 'emitAfter' , {
275- get : internalUtil . deprecate ( function ( ) {
276- return emitAfter ;
277- } , 'async_hooks.emitAfter is deprecated. ' +
278- 'Use AsyncResource.emitAfter instead.' , 'DEP0085' )
279- } ) ;
280-
281- Object . defineProperty ( module . exports , 'emitDestroy' , {
282- get : internalUtil . deprecate ( function ( ) {
283- return emitDestroy ;
284- } , 'async_hooks.emitDestroy is deprecated. ' +
285- 'Use AsyncResource.emitDestroy instead.' , 'DEP0085' )
286- } ) ;
0 commit comments