Open nightwing opened 10 years ago
We do this by emitting an event on the eventbus when architect is ready and pass the app as argument. This way you can do soft-dependencies:
imports.eventbus.on('architect-ready', app => {
var interval = app.services['gonzo-service/interval'];
});
usecase:
Cloud9 ace plugin reloads document when file on disk changes. If diffing library is present, it can apply diff, to keep editor state like selection and folds. But in case there is no diffing library, simply setting value is good enough.
Now adding dependency on diffing plugin, will break all configs using ace, and will require all of them to either include the diffing lib, or to include mock plugin as a fallback.
I think this is bad because it makes local change in ace plugin, into breaking change for all its consumers. But If optional dependencies were supported, only apps that needed diffing, would include it and it would only require one if statement in the ace plugin.