   # This service provides access to XO objects.
   #
   # Deprecated: use the service `xo` instead.
-  .service 'xoObjects', ($timeout, xoApi) ->
+  .service 'xoObjects', ($timeout, xoApi, $rootScope) ->
     byRefs = Object.create null
     byUUIDs = Object.create null
     {

              list.length
            list[index] = object
      ++xoObjects.revision

    xoObjects


    }

    xoApi.call('xo.getAllObjects').then (objects) ->
      # Empty collections.
      delete byTypes[key] for key of byTypes
      byRefs = Object.create null
      byUUIDs = Object.create null

      all = objects
      for object in all
        byUUIDs[object.UUID] = object if object.UUID?
        byRefs[object.ref] = object if object.ref?
        (byTypes[object.type] ?= []).push object

      ++xoObjects.revision
    xoApi.on 'all', (event) ->
      switch event.type
        when 'exit'
