Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable asynchronous Instantiation. #7

Open
h4cc opened this issue Feb 13, 2015 · 0 comments
Open

Enable asynchronous Instantiation. #7

h4cc opened this issue Feb 13, 2015 · 0 comments
Labels

Comments

@h4cc
Copy link
Member

h4cc commented Feb 13, 2015

Currently, Einigeln is fully synchronous. This could be changed with some additional API parameters.

Example:

di.set('foo', function(container, resolve) {
  // Not returning any value here, so Einigeln will assume resolve will be called when ready.
  setTimeout(function() {
    resolve(new Foo(container.get('bar')));
  }, 1000);
});

The additional API Call:

di.getAsync('foo').then(console.log);

For such a feature, get() needs to realize when a service used returnand when it using resolve.
So kind of a Map with a flag for each service if it is async needs to be added. Depending on that flag either get or getAsync will access each other on behalf.

@h4cc h4cc added the idea label Feb 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant