Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Add a way to mark some of the dependencies as optional. #36

Open
nightwing opened this issue Apr 13, 2014 · 1 comment
Open

Add a way to mark some of the dependencies as optional. #36

nightwing opened this issue Apr 13, 2014 · 1 comment

Comments

@nightwing
Copy link
Member

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.

@janjongboom
Copy link
Contributor

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'];
    });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants