Skip to content
brian428 edited this page Feb 26, 2013 · 2 revisions

Back to Advanced IoC Configuration

The Injector can also be configured to map identifiers to values::

Deft.Injector.configure({

  brandedApplicationName: {
    value: "Contact Manager"
  },
  
  versionNumber: {
    value: 1.0
  },
  
  modules: {
    value: [ 'contacts', 'customers', 'orders' ]
  },
  
  ...
});

A value can be any native JavaScript type, including Strings, Arrays, Numbers, Objects or class instances… even Functions!

**NOTE: Values can only be configured as singletons and cannot be eagerly instantiated.