ModelN/backbone.geppetto — pull request #58 by creynders (2014-09-03 10:35:12+00:00)
Title: Passing configuration to lazily instantiated objects

I've found need for being able to pass a configuration object to instances that are created by the resolver.

E.g.:

```js
this.context.wireValue( 'account.api.url', this.config.api.root + '/me/account' );
this.context.wireSingleton( 'accountModel', UserModel, {
url : 'account.api.url'
} );
```

Here I want the UserModel instance to be injected with a specific url upon instantiation.
The above is obviously a solution, but a bit cumbersome. For instance if there are any other config options I'd like to pass, I'll need to wire them as values as well.
In this case I use the optional `wiring` parameter all wire* methods have, but TBH I think this has very little use cases and am starting to think it would be better to turn it into an optional `options` parameter.
So we could do this:

```js
this.context.wireSingleton( 'accountModel', UserModel, {
url : this.config.api.root + '/me/account'
} );
```

Obviously this would be a breaking change. If you don't like this approach how about a separate method, something like:

```js
this.context.wireSingleton( 'accountModel', UserModel);
this.context.configure('accountModel', {
url : this.config.api.root + '/me/account'
} );
```