     appView?.once "KDObjectWillBeDestroyed", =>
       @unregister appInstance
       appInstance.emit "AppDidQuit"
+      KD.getSingleton('appManager').emit  "AppDidQuit", appInstance
 
   setLastActiveIndex:(appInstance)->
 

      @appControllers[name].instances.splice index, 1
      if @appControllers[name].instances.length is 0
        delete @appControllers[name]
      appInstance.destroy()

  createPromptModal:(appOptions, callback)->
    # show modal and wait for response


  quit:(appInstance, callback = noop)->

    appInstance.getView().destroy()
    callback()

  quitAll:->
