 
 exports.cleanup = () ->
   for remove in listeners
-    log "removing listener"
     remove()

  eventEmitter = new EventEmitter()

  builder =
    # helper: move to debugger?
    loadProperties: (ref) ->
      log "builder.loadProperties #{ref}"
      _debugger

        when 'function'
          TreeViewItem("#{name} : function() { ... }", handlers: handlers)
        when 'object'
          ref = value.value.ref || value.value.handle
          isArray = className is "Array"
          (if isArray then builder.loadArrayLength(ref) else Promise.resolve(0)).then (len) ->
            decorate =
              (title) ->
                (state) ->
                  if state.isOpen
                    title
                  else
                    if isArray
                      "#{title} [ #{len} ]"
                    else
                      "#{title} { ... }"

            TreeView(decorate("#{name} : #{className}"), (() => builder.loadProperties(ref).map(builder.property)), handlers: handlers)

    frame: (frame) ->
      log "builder.frame #{frame.script.name}, #{frame.script.line}"
