| Summary: | Listener support for a "loaded"/"loading" event in the Pluginregistry | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Simon Kaegi <simon_kaegi> |
| Component: | Client | Assignee: | Mark Macdonald <mamacdon> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | mamacdon |
| Version: | 0.5 | ||
| Target Milestone: | 0.5 RC1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Simon Kaegi
Here is a patch that adds a 'lazyLoading' event, which fires after a plugin's iframe has been created but before the lazy service call happens. Listeners for this event can provide a 'before' promise, in which case the registry waits for the promise to resolve before continuing with the lazy service call. http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?h=config&id=64bc828f81e47345ffabd3119e0933ef571dbc70 OK, I updated the patch. It no longer allows a 'lazyLoading' listener to provide an async task, so there's no risk of halting the plugin load by waiting on a dead promise. LazyLoading listeners are invoked synchronously. The lazyLoading event fires once for a plugin. A lazyLoading listener is allowed to invoke a service method (say 'B()') of the plugin that is currently lazy-loading. In this case, we have a recursive call to the function at line 55 of pluginregistry.js. The recursive call finds _firedLazyLoading == true, so the recursive call gets its hands on the Plugin's _load() promise before the call higher-up on the stack. As a result, the listener's injected service call 'B()' should always appear on the _load() queue preceding the original service call 'A()' that triggered the lazy load. The new patch is here: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?h=config&id=40941f19421c2dad3adce036b62cb440b303b430 The event is now called 'pluginLoaded' and it is dispatched after every load (both lazy and non-lazy). http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?h=config&id=17580012811a24732250d7a7282a6248aaa6b17b |