Only dispose PaneElement subscriptions when pane is destroyed

Not when the element is detached, because it might be reattached.
This commit is contained in:
Nathan Sobo
2014-09-18 13:34:18 -06:00
parent f76f7e17d3
commit 60a551b308

View File

@@ -12,9 +12,6 @@ class PaneElement extends HTMLElement
attachedCallback: ->
@focus() if @model.isFocused()
detachedCallback: ->
@subscriptions.dispose()
initializeContent: ->
@setAttribute 'class', 'pane'
@setAttribute 'tabindex', -1
@@ -36,6 +33,7 @@ class PaneElement extends HTMLElement
@subscriptions.add @model.observeActive(@activeStatusChanged.bind(this))
@subscriptions.add @model.observeActiveItem(@activeItemChanged.bind(this))
@subscriptions.add @model.onDidRemoveItem(@itemRemoved.bind(this))
@subscriptions.add @model.onDidDestroy(@paneDestroyed.bind(this))
@__spacePenView.setModel(@model)
activated: ->
@@ -69,6 +67,9 @@ class PaneElement extends HTMLElement
else
viewToRemove.detach()
paneDestroyed: ->
@subscriptions.dispose()
getActiveView: -> @model.getView(@model.getActiveItem())
hasFocus: ->