Theia: Is there any event fired on theia completely loaded ?

Created on 16 Apr 2020  路  2Comments  路  Source: eclipse-theia/theia

Description

Hi,
I'm trying to hide my custom menu item (extension) at theia load initialization process, and show the menu item only by trigger that fire on run time.

I tried different approaches:
1). Inject into my service the module 'MenuModelRegistry' and by run-time execute registerMenuAction(path, item), But I find out that if I'm not implementing 'MenuContribution' - 'registerMenus' method it's not gonna recognize my menu item by run time.

2). So I implemented 'MenuContribution' - 'registerMenus' method and register the menu (registerMenuAction), and immediately after I have unregistered him (unregisterMenuAction). but then - at run time I discovered the same problem as section 1.

3). I tried to make timeout until all theia system completely loaded - then I fired 'unregisterMenuAction' - that works. Then at run-time I can apply 'registerMenuAction' and its works fine - But I'm searching approach to avoid timeout - maybe any event related to the system that I can register.
(By the way - all document/window load events are triggered too early and it's returning me to section 2 - too early).

Is there any suggestion to sign up for an event that signals me that the whole system has been loaded ?
Is there maybe any other approach to solve the issue ?

Thank you,

question

All 2 comments

I believe you can take a look at the following example, the widget is opened when the application has reached a 'ready' state (completed loading and initialization) and no workspace is present. In your case you will likely only care about when the state is 'ready':

https://github.com/eclipse-theia/theia/blob/f69191825788bcd8054ab77831707960f0660a04/packages/getting-started/src/browser/getting-started-contribution.ts#L51-L57

Yes, meanwhile I find the service - FrontendApplicationStateService and registered to 'onStateChanged' until I get 'ready' - I think it's the same - thank you !

Was this page helpful?
0 / 5 - 0 ratings