File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -259,6 +259,33 @@ class VirtualMachine extends EventEmitter {
259259 } ;
260260 }
261261
262+ getLoadedExtensionsInfo ( ) {
263+ const extensionManager = this . extensionManager ;
264+ const runtime = this . runtime ;
265+
266+ if ( ! extensionManager || ! runtime ) {
267+ console . error ( 'Virtual Machine is not properly initialized with an ExtensionManager and Runtime.' ) ;
268+ return [ ] ;
269+ }
270+
271+ const loadedExtensionIds = new Set ( extensionManager . _loadedExtensions . keys ( ) ) ;
272+ const allRegisteredCategories = runtime . _blockInfo ;
273+ const extensionsInfo = [ ] ;
274+
275+ for ( const category of allRegisteredCategories ) {
276+ if ( loadedExtensionIds . has ( category . id ) ) {
277+ extensionsInfo . push ( {
278+ id : category . id ,
279+ name : category . name ,
280+ icon : category . blockIconURI || category . menuIconURI ,
281+ color : category . color1
282+ } ) ;
283+ }
284+ }
285+
286+ return extensionsInfo ;
287+ }
288+
262289 /**
263290 * Start running the VM - do this before anything else.
264291 */
You can’t perform that action at this time.
0 commit comments