Closed PhantomYopta closed 4 weeks ago
Currently capabilities are generally registered in the load method and then used from within all plugins loaded. How do you see this flow working? Will plugins register capabilities in all plugins loaded and then listen to the event?
let's say there are 3 plugins
api of plugin 2
depends on the api of plugin 1
plugin 3
depends on api of plugin 2
, but since plugin 2
depends on plugin 1
, plugin 2
will have to register capability in OnAllPluginsLoaded
and then plugin 3
will not be able to get api of plugin 2
in OnAllPluginsLoaded
.
I think the problem is solved simply if the plugin simply subscribed in Load
to the event when the capability was registered
Thus a plugin that does not depend on other plugins simply registers capability in OnAllPluginsLoad
, and other plugins that already depend on it, subscribe to capability registration in Load
and register their api when event occurs.
Could you please add an event to PluginCapability that triggers when a Capability is registered, and also ensure that it is triggered immediately if it's already registered? It's very difficult to deal with when you have a chain of dependencies.
We had a slight issue when we implemented an event firing / listening flow for Retakes.
For us it was solved by ensuring the dependencies were loaded in the correct order (alphabetically) which required slight file name changes.
I suspect the way we're firing / listening to events in our plugin could be slightly modified to fit your use case.
Could you please add an event to PluginCapability that triggers when a Capability is registered, and also ensure that it is triggered immediately if it's already registered? It's very difficult to deal with when you have a chain of dependencies.