Skip to content

Commit

Permalink
Refactors transient dependency implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarenaldi committed Aug 7, 2014
1 parent 076728d commit 846c771
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import createRegistrationAPI from './createRegistrationAPI';
class Context {

constructor(conf, logger, mappings, signalRelease) {
var context
var api

if (typeof conf !== 'function') {
throw new Error('Invalid container creation, missing contribution function')
Expand All @@ -25,9 +25,9 @@ class Context {
this._signalRelease = signalRelease || noop

this._bind(CONTEXT_ALIAS, this, VALUE, [])
context = this._context = createRegistrationAPI(this._bind.bind(this))
conf(context.map)
context.done()
api = createRegistrationAPI(this._bind.bind(this))
conf(api.map)
api.done()
}

get(alias) {
Expand All @@ -50,13 +50,11 @@ class Context {
using(transientsDeps) {
return {
get: (alias) => {
var context = this._context
var dep

for (dep in transientsDeps) {
context.map(dep).to(transientsDeps[dep]).as(VALUE)
this._bind(dep, transientsDeps[dep], VALUE, [])
}
context.done()
this.get(alias)
for (dep in transientsDeps) {
this._unbind(dep)
Expand Down

0 comments on commit 846c771

Please sign in to comment.