1
1
'use strict' ;
2
2
3
3
const errors = require ( 'internal/errors' ) ;
4
- const internalUtil = require ( 'internal/util' ) ;
5
4
const async_wrap = process . binding ( 'async_wrap' ) ;
6
5
const internal_async_hooks = require ( 'internal/async_hooks' ) ;
7
6
8
7
// 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 ;
12
8
// For userland AsyncResources, make sure to emit a destroy event when the
13
9
// resource gets gced.
14
10
const { registerDestroyHook } = async_wrap ;
@@ -17,10 +13,9 @@ const {
17
13
getHookArrays,
18
14
enableHooks,
19
15
disableHooks,
20
- // Sensitive Embedder API
16
+ // Internal Embedder API
21
17
newUid,
22
18
initTriggerId,
23
- setInitTriggerId,
24
19
emitInit,
25
20
emitBefore,
26
21
emitAfter,
@@ -204,18 +199,6 @@ class AsyncResource {
204
199
}
205
200
206
201
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
-
219
202
// Placing all exports down here because the exported classes won't export
220
203
// otherwise.
221
204
module . exports = {
@@ -226,61 +209,3 @@ module.exports = {
226
209
// Embedder API
227
210
AsyncResource,
228
211
} ;
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