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

Asynchronous Injection #25

Closed
ecowden opened this issue Jan 29, 2017 · 1 comment
Closed

Asynchronous Injection #25

ecowden opened this issue Jan 29, 2017 · 1 comment
Assignees
Milestone

Comments

@ecowden
Copy link
Owner

ecowden commented Jan 29, 2017

Pluto should support asynchronous bootstrapping by automatically detecting and resolving promises, then injecting their resolved values when used as a dependency.

Sample usage:

  function Greeter(name) {
    this.name = name
  }

  Greeter.prototype.greet = function () {
    return `Hello, ${this.name}!`
  }

  const bind = pluto()
  bind('name').toInstance(Promise.resolve('World'))
  bind('greeter').toConstructor(Greeter)

  const theGreeter = yield bind.get('greeter')

  t.is(theGreeter.greet(), 'Hello, World!')
@ecowden ecowden modified the milestone: v1.0 Jan 29, 2017
@ecowden ecowden self-assigned this Jan 29, 2017
@ecowden
Copy link
Owner Author

ecowden commented Jan 29, 2017

Fixed on one-oh-redesign branch.

@ecowden ecowden closed this as completed Jan 29, 2017
@ecowden ecowden mentioned this issue Jan 29, 2017
ecowden added a commit that referenced this issue Feb 4, 2017
Fixes #15, fixes #25, fixes #26, fixes #27, fixes #28, fixes #29.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant