Add Pane::onDidActivate

This commit is contained in:
Nathan Sobo
2014-08-27 10:22:14 -06:00
parent 548018e9b2
commit 2d58d9c8b5
3 changed files with 29 additions and 0 deletions

View File

@@ -36,6 +36,8 @@ class PaneContainer extends Model
root: @root?.serialize()
activePaneId: @activePane.id
getRoot: -> @root
replaceChild: (oldChild, newChild) ->
throw new Error("Replacing non-existent child") if oldChild isnt @root
@root = newChild

View File

@@ -94,6 +94,9 @@ class Pane extends Model
# Called by the view layer to construct a view for this model.
getViewClass: -> PaneView ?= require './pane-view'
onDidActivate: (fn) ->
@emitter.on 'did-activate', fn
onDidAddItem: (fn) ->
@emitter.on 'did-add-item', fn
@@ -123,6 +126,7 @@ class Pane extends Model
activate: ->
@container?.activePane = this
@emit 'activated'
@emitter.emit 'did-activate'
getPanes: -> [this]