@@ -102,8 +102,8 @@ async function connect () {
102
102
103
103
// Apps
104
104
105
- hook . on ( HookEvents . APP_UNMOUNT , app => {
106
- removeApp ( app , ctx )
105
+ hook . on ( HookEvents . APP_UNMOUNT , async app => {
106
+ await removeApp ( app , ctx )
107
107
} )
108
108
109
109
// Components
@@ -209,22 +209,22 @@ async function connect () {
209
209
210
210
// Component perf
211
211
212
- hook . on ( HookEvents . PERFORMANCE_START , ( app , uid , vm , type , time ) => {
213
- performanceMarkStart ( app , uid , vm , type , time , ctx )
212
+ hook . on ( HookEvents . PERFORMANCE_START , async ( app , uid , vm , type , time ) => {
213
+ await performanceMarkStart ( app , uid , vm , type , time , ctx )
214
214
} )
215
215
216
- hook . on ( HookEvents . PERFORMANCE_END , ( app , uid , vm , type , time ) => {
217
- performanceMarkEnd ( app , uid , vm , type , time , ctx )
216
+ hook . on ( HookEvents . PERFORMANCE_END , async ( app , uid , vm , type , time ) => {
217
+ await performanceMarkEnd ( app , uid , vm , type , time , ctx )
218
218
} )
219
219
220
220
// Highlighter
221
221
222
- hook . on ( HookEvents . COMPONENT_HIGHLIGHT , instanceId => {
223
- highlight ( ctx . currentAppRecord . instanceMap . get ( instanceId ) , ctx . currentAppRecord . backend , ctx )
222
+ hook . on ( HookEvents . COMPONENT_HIGHLIGHT , async instanceId => {
223
+ await highlight ( ctx . currentAppRecord . instanceMap . get ( instanceId ) , ctx . currentAppRecord . backend , ctx )
224
224
} )
225
225
226
- hook . on ( HookEvents . COMPONENT_UNHIGHLIGHT , ( ) => {
227
- unHighlight ( )
226
+ hook . on ( HookEvents . COMPONENT_UNHIGHLIGHT , async ( ) => {
227
+ await unHighlight ( )
228
228
} )
229
229
230
230
// Timeline
@@ -260,19 +260,19 @@ async function connect () {
260
260
ctx . bridge . send ( BridgeEvents . TO_FRONT_CUSTOM_INSPECTOR_ADD , { } )
261
261
} )
262
262
263
- hook . on ( HookEvents . CUSTOM_INSPECTOR_SEND_TREE , ( inspectorId : string , plugin : Plugin ) => {
263
+ hook . on ( HookEvents . CUSTOM_INSPECTOR_SEND_TREE , async ( inspectorId : string , plugin : Plugin ) => {
264
264
const inspector = getInspector ( inspectorId , plugin . descriptor . app , ctx )
265
265
if ( inspector ) {
266
- sendInspectorTree ( inspector , ctx )
266
+ await sendInspectorTree ( inspector , ctx )
267
267
} else if ( SharedData . debugInfo ) {
268
268
console . warn ( `Inspector ${ inspectorId } not found` )
269
269
}
270
270
} )
271
271
272
- hook . on ( HookEvents . CUSTOM_INSPECTOR_SEND_STATE , ( inspectorId : string , plugin : Plugin ) => {
272
+ hook . on ( HookEvents . CUSTOM_INSPECTOR_SEND_STATE , async ( inspectorId : string , plugin : Plugin ) => {
273
273
const inspector = getInspector ( inspectorId , plugin . descriptor . app , ctx )
274
274
if ( inspector ) {
275
- sendInspectorState ( inspector , ctx )
275
+ await sendInspectorState ( inspector , ctx )
276
276
} else if ( SharedData . debugInfo ) {
277
277
console . warn ( `Inspector ${ inspectorId } not found` )
278
278
}
@@ -289,8 +289,18 @@ async function connect () {
289
289
290
290
// Plugins
291
291
292
- addPreviouslyRegisteredPlugins ( ctx )
293
- addQueuedPlugins ( ctx )
292
+ try {
293
+ await addPreviouslyRegisteredPlugins ( ctx )
294
+ } catch ( e ) {
295
+ console . error ( `Error adding previously registered plugins:` )
296
+ console . error ( e )
297
+ }
298
+ try {
299
+ await addQueuedPlugins ( ctx )
300
+ } catch ( e ) {
301
+ console . error ( `Error adding queued plugins:` )
302
+ console . error ( e )
303
+ }
294
304
295
305
hook . on ( HookEvents . SETUP_DEVTOOLS_PLUGIN , async ( pluginDescriptor : PluginDescriptor , setupFn : SetupFunction ) => {
296
306
await addPlugin ( { pluginDescriptor, setupFn } , ctx )
@@ -300,11 +310,11 @@ async function connect () {
300
310
301
311
// Legacy flush
302
312
303
- const handleFlush = debounce ( ( ) => {
313
+ const handleFlush = debounce ( async ( ) => {
304
314
if ( ctx . currentAppRecord ?. backend . options . features . includes ( BuiltinBackendFeature . FLUSH ) ) {
305
- sendComponentTreeData ( ctx . currentAppRecord , '_root' , ctx . currentAppRecord . componentFilter , null , ctx )
315
+ await sendComponentTreeData ( ctx . currentAppRecord , '_root' , ctx . currentAppRecord . componentFilter , null , ctx )
306
316
if ( ctx . currentInspectedComponentId ) {
307
- sendSelectedComponentData ( ctx . currentAppRecord , ctx . currentInspectedComponentId , ctx )
317
+ await sendSelectedComponentData ( ctx . currentAppRecord , ctx . currentInspectedComponentId , ctx )
308
318
}
309
319
}
310
320
} , 500 )
@@ -314,13 +324,18 @@ async function connect () {
314
324
315
325
// Connect done
316
326
317
- addTimelineMarker ( {
318
- id : 'vue-devtools-init-backend' ,
319
- time : Date . now ( ) ,
320
- label : 'Vue Devtools connected' ,
321
- color : 0x41B883 ,
322
- all : true ,
323
- } , ctx )
327
+ try {
328
+ await addTimelineMarker ( {
329
+ id : 'vue-devtools-init-backend' ,
330
+ time : Date . now ( ) ,
331
+ label : 'Vue Devtools connected' ,
332
+ color : 0x41B883 ,
333
+ all : true ,
334
+ } , ctx )
335
+ } catch ( e ) {
336
+ console . error ( `Error while adding devtools connected timeline marker:` )
337
+ console . error ( e )
338
+ }
324
339
}
325
340
326
341
function connectBridge ( ) {
@@ -343,8 +358,8 @@ function connectBridge () {
343
358
344
359
// Apps
345
360
346
- ctx . bridge . on ( BridgeEvents . TO_BACK_APP_LIST , ( ) => {
347
- sendApps ( ctx )
361
+ ctx . bridge . on ( BridgeEvents . TO_BACK_APP_LIST , async ( ) => {
362
+ await sendApps ( ctx )
348
363
} )
349
364
350
365
ctx . bridge . on ( BridgeEvents . TO_BACK_APP_SELECT , async id => {
@@ -365,18 +380,18 @@ function connectBridge () {
365
380
366
381
// Components
367
382
368
- ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_TREE , ( { instanceId, filter } ) => {
383
+ ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_TREE , async ( { instanceId, filter } ) => {
369
384
ctx . currentAppRecord . componentFilter = filter
370
- sendComponentTreeData ( ctx . currentAppRecord , instanceId , filter , null , ctx )
371
385
subscribe ( BridgeSubscriptions . COMPONENT_TREE , { instanceId } )
386
+ await sendComponentTreeData ( ctx . currentAppRecord , instanceId , filter , null , ctx )
372
387
} )
373
388
374
- ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_SELECTED_DATA , ( instanceId ) => {
375
- sendSelectedComponentData ( ctx . currentAppRecord , instanceId , ctx )
389
+ ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_SELECTED_DATA , async ( instanceId ) => {
390
+ await sendSelectedComponentData ( ctx . currentAppRecord , instanceId , ctx )
376
391
} )
377
392
378
- ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_EDIT_STATE , ( { instanceId, dotPath, type, value, newKey, remove } ) => {
379
- editComponentState ( instanceId , dotPath , type , { value, newKey, remove } , ctx )
393
+ ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_EDIT_STATE , async ( { instanceId, dotPath, type, value, newKey, remove } ) => {
394
+ await editComponentState ( instanceId , dotPath , type , { value, newKey, remove } , ctx )
380
395
} )
381
396
382
397
ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_INSPECT_DOM , async ( { instanceId } ) => {
@@ -456,12 +471,12 @@ function connectBridge () {
456
471
457
472
// Highlighter
458
473
459
- ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_MOUSE_OVER , instanceId => {
460
- highlight ( ctx . currentAppRecord . instanceMap . get ( instanceId ) , ctx . currentAppRecord . backend , ctx )
474
+ ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_MOUSE_OVER , async instanceId => {
475
+ await highlight ( ctx . currentAppRecord . instanceMap . get ( instanceId ) , ctx . currentAppRecord . backend , ctx )
461
476
} )
462
477
463
- ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_MOUSE_OUT , ( ) => {
464
- unHighlight ( )
478
+ ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_MOUSE_OUT , async ( ) => {
479
+ await unHighlight ( )
465
480
} )
466
481
467
482
// Component picker
@@ -478,12 +493,12 @@ function connectBridge () {
478
493
479
494
// Timeline
480
495
481
- ctx . bridge . on ( BridgeEvents . TO_BACK_TIMELINE_LAYER_LIST , ( ) => {
482
- sendTimelineLayers ( ctx )
496
+ ctx . bridge . on ( BridgeEvents . TO_BACK_TIMELINE_LAYER_LIST , async ( ) => {
497
+ await sendTimelineLayers ( ctx )
483
498
} )
484
499
485
- ctx . bridge . on ( BridgeEvents . TO_BACK_TIMELINE_SHOW_SCREENSHOT , ( { screenshot } ) => {
486
- showScreenshot ( screenshot , ctx )
500
+ ctx . bridge . on ( BridgeEvents . TO_BACK_TIMELINE_SHOW_SCREENSHOT , async ( { screenshot } ) => {
501
+ await showScreenshot ( screenshot , ctx )
487
502
} )
488
503
489
504
ctx . bridge . on ( BridgeEvents . TO_BACK_TIMELINE_CLEAR , async ( ) => {
@@ -494,8 +509,8 @@ function connectBridge () {
494
509
await sendTimelineEventData ( id , ctx )
495
510
} )
496
511
497
- ctx . bridge . on ( BridgeEvents . TO_BACK_TIMELINE_LAYER_LOAD_EVENTS , ( { appId, layerId } ) => {
498
- sendTimelineLayerEvents ( appId , layerId , ctx )
512
+ ctx . bridge . on ( BridgeEvents . TO_BACK_TIMELINE_LAYER_LOAD_EVENTS , async ( { appId, layerId } ) => {
513
+ await sendTimelineLayerEvents ( appId , layerId , ctx )
499
514
} )
500
515
501
516
ctx . bridge . on ( BridgeEvents . TO_BACK_TIMELINE_LOAD_MARKERS , async ( ) => {
@@ -504,8 +519,8 @@ function connectBridge () {
504
519
505
520
// Custom inspectors
506
521
507
- ctx . bridge . on ( BridgeEvents . TO_BACK_CUSTOM_INSPECTOR_LIST , ( ) => {
508
- sendCustomInspectors ( ctx )
522
+ ctx . bridge . on ( BridgeEvents . TO_BACK_CUSTOM_INSPECTOR_LIST , async ( ) => {
523
+ await sendCustomInspectors ( ctx )
509
524
} )
510
525
511
526
ctx . bridge . on ( BridgeEvents . TO_BACK_CUSTOM_INSPECTOR_TREE , async ( { inspectorId, appId, treeFilter } ) => {
0 commit comments