     @panels = []
 
   destroy: ->
-    pane.destroy() for pane in @getPanels()
+    panel.destroy() for panel in @getPanels()
     @subscriptions.dispose()
     @emitter.emit 'did-destroy', this
     @emitter.dispose()

  getPanels: -> @panels

  addPanel: (panel) ->
    @subscriptions.add panel.onDidDestroy(@panelDestoryed.bind(this))

    index = @getPanelIndex(panel)
    if index is @panels.length

    @emitter.emit 'did-add-panel', {panel, index}
    panel

  panelDestroyed: (panel) ->
    index = @panels.indexOf(panel)
    if index > -1
      @panels.splice(index, 1)
