File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ const {
36
36
NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END
37
37
} = constants ;
38
38
39
+ const { AsyncResource } = require ( 'async_hooks' ) ;
39
40
const L = require ( 'internal/linkedlist' ) ;
40
41
const kInspect = require ( 'internal/util' ) . customInspectSymbol ;
41
42
const { inherits } = require ( 'util' ) ;
@@ -317,12 +318,13 @@ class PerformanceObserverEntryList {
317
318
}
318
319
}
319
320
320
- class PerformanceObserver {
321
+ class PerformanceObserver extends AsyncResource {
321
322
constructor ( callback ) {
322
323
if ( typeof callback !== 'function' ) {
323
324
const errors = lazyErrors ( ) ;
324
325
throw new errors . TypeError ( 'ERR_INVALID_CALLBACK' ) ;
325
326
}
327
+ super ( 'PerformanceObserver' ) ;
326
328
Object . defineProperties ( this , {
327
329
[ kTypes ] : {
328
330
enumerable : false ,
@@ -568,7 +570,7 @@ function getObserversList(type) {
568
570
569
571
function doNotify ( ) {
570
572
this [ kQueued ] = false ;
571
- this [ kCallback ] ( this [ kBuffer ] , this ) ;
573
+ this . runInAsyncScope ( this [ kCallback ] , this , this [ kBuffer ] , this ) ;
572
574
this [ kBuffer ] [ kEntries ] = [ ] ;
573
575
L . init ( this [ kBuffer ] [ kEntries ] ) ;
574
576
}
You can’t perform that action at this time.
0 commit comments