     componentName: undefined
     cycles: undefined
 
+    getMessage: ->
+      "Component '#{@componentName}' has cycles:\n" +
+      @inspectCycles()
+
     inspectCycles: ->
       mapFn = (cycle) -> "* #{cycle.join(" > ")}"
       @cycles.map(mapFn).join("\n")
 
-    Object.defineProperty @prototype, "message", get: ->
-      "Component '#{@componentName}' has cycles:\n" +
-      @inspectCycles()
-
   class ComponentUndefined extends CustomError
     componentName: undefined
 
-    Object.defineProperty @prototype, "message", get: ->
+    getMessage: ->
       "Component not defined: '#{@componentName}'"
 
+  class DictionaryEvent
+    constructor: (properties = {}) ->
+      @name = @constructor.name
+      @setPayload properties.payload
+
+    setPayload: (payload = {}) ->
+      @payload = {}
+      @payload.dictionary = payload.dictionary
+      @payload.key = payload.key
+
+  class DictionaryValueSet extends DictionaryEvent
+
+  class DictionaryValueRemoved extends DictionaryEvent
+
   class Dictionary
-    @definitions: undefined
-
-    constructor: (properties = {}) ->
-      @[key] = val for own key,val of properties
-      @definitions ?= {}
-
-    set: (name, value) ->
-      @definitions[name] = value
-
-    get: (name, value) ->
-      @definitions[name]
-
-    isDefined: (name) ->
-      @definitions[name] != undefined
-
-    isUndefined: (name) ->
-      @definitions[name] == undefined
+
+    constructor: (properties = {}) ->
+      _emitter = properties.eventEmitter ? $.createEventEmitter()
+
+      @emit = (args...) -> _emitter.emit args...
+      @addListener = (args...) -> _emitter.addListener args...
+      @removeListener = (args...) -> _emitter.removeListener args...
+      @removeAllListeners = (args...) -> _emitter.removeAllListeners args...
+
+      _definitions = $.assign $.createObject(null), properties.definitions
+
+      $.defineProperty @, "definitions", enumerable: true, get: ->
+        $.assign {}, _definitions
+
+      @get = (key) ->
+        _definitions[key]
+
+      @set = (key, value) ->
+        result = _definitions[key] = value
+        @emit "set", new DictionaryValueSet
+          payload: { dictionary: @, key: key }
+        return result
+
+      @remove = (key) ->
+        value = _definitions[key]
+        result = delete _definitions[key]
+        @emit "remove", new DictionaryValueRemoved
+          payload: { dictionary: @, key: key }
+        return result
+
+    addListener: (args...) -> @emitter.addListener args...
+    removeListener: (args...) -> @emitter.removeListener args...
+    removeAllListeners: (args...) -> @emitter.removeAllListeners args...
+
+    isDefined: (key) ->
+      @get(key) != undefined
+
+    isUndefined: (key) ->
+      @get(key) == undefined
 
   class Components extends Dictionary
 

      catch error then done error

  class Component
    dependencies: undefined
    factory: undefined

    constructor: (properties = {}) ->
      @[key] = val for own key,val of properties

      @dependencies ?= []
      @factory ?= null

    resolveDependencies: (container, done) ->
      resolveComponent = container.resolveComponent.bind container

  class Promises extends Dictionary

  class Container

    constructor: (properties = {}) ->
      @components = new Components properties.components
      @promises = new Promises properties.promises

      @components.addListener "set", (event) =>
        @promises.remove event.payload.key

      @components.addListener "remove", (event) =>
        @promises.remove event.payload.key

    createComponentPromise: (name) ->
      $.createPromise (resolve, reject) =>
