Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Clean Up Workspace Event Subscription API #3418

Merged
merged 65 commits into from
Sep 4, 2014
Merged
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
ebb02bc
Use public getters instead of properties in pane-spec
Aug 27, 2014
b8fcbe9
Start adding event subscription methods to pane
Aug 27, 2014
9bd2eec
Add Pane::onDidMoveItem()
Aug 27, 2014
548018e
Add spec for onDidRemoveItem observers when moving items to other panes
Aug 27, 2014
2d58d9c
Add Pane::onDidActivate
Aug 27, 2014
8225f75
Add Pane::onWillDestroyItem()
Aug 27, 2014
2b63f8a
Add PaneContainer::onDidChangeActivePane
Aug 27, 2014
44d70aa
Add Pane::onDidChangeActive()
Aug 27, 2014
b6c669a
Subscribe with new event methods in PaneView
Aug 27, 2014
e7a7e86
Add Pane::observeActive and ::observeActiveItem
Aug 27, 2014
87cdc1a
Don’t invoke ::onDidChangeActivePane events unless it really changes
Aug 27, 2014
99d70b4
Don’t emit ::onDidChangeActiveItem events unless it really changes
Aug 27, 2014
40d93cd
Use Pane::setActiveItem internally so observers are invoked
Aug 27, 2014
475dc60
:lipstick:
Aug 27, 2014
b9feed8
Handle objects in subscriptions instead of multiple args
Aug 27, 2014
1d365db
Use getActiveItem getter in pane-view-spec
Aug 27, 2014
4f826a7
Use Array instead of Sequence for Pane::items
Aug 27, 2014
f161f53
Don’t rely on Sequences to reparent the last child
Aug 27, 2014
a9294ae
Don’t use Sequence in PaneAxis
Aug 27, 2014
9979ae4
Add child event methods to PaneAxis
Aug 27, 2014
c25ab0d
Rename ::disposables to ::subscriptions in PaneView
Aug 27, 2014
67c3a41
Upgrade event-kit to fix bug and get CompositeDisposable::remove
Aug 27, 2014
da63c6b
Add ::onDidDestroy to Pane and PaneAxis
Aug 27, 2014
9487609
:lipstick: pane-container-spec
Aug 27, 2014
b89202f
Dispose of PaneAxis subscriptions when destroyed
Aug 27, 2014
74b2f26
Add PaneContainer::onDidChangeActivePaneItem
Aug 27, 2014
cf3e117
Upgrade event-kit to fix stupid bug
Aug 28, 2014
b34367a
:lipstick: pane-container-spec
Aug 28, 2014
b74554a
Actually subscribe
Aug 28, 2014
7556b85
Remove/add the *subscription*, not the child
Aug 28, 2014
9223361
Add PaneContainer::onDidChange/observeRoot
Aug 28, 2014
b191606
Delegate ::getActivePane[Item] directly to PaneContainer
Aug 28, 2014
95e9686
Emit legacy item-added DOM event correctly
Aug 28, 2014
34cb5d6
Don’t implement ::isActive in terms of the theorist model behavior
Aug 28, 2014
d7063c0
Add Pane::onDidDestroy
Aug 28, 2014
e88eb30
Document Pane event subscription methods
Aug 28, 2014
78c24fb
Remove legacy event documentation
Aug 28, 2014
345617e
Clean up existing pane API docs
Aug 28, 2014
cea4db5
Break pane API into sections
Aug 28, 2014
12f78dd
:lipstick:
Aug 28, 2014
b60b9f3
Add Pane::observeItems
Aug 28, 2014
5471e9b
Add PaneContainer::onDidDestroyPaneItem
Aug 28, 2014
cee7539
Add PaneContainer::observePanes and ::onDidAddPane
Aug 28, 2014
877fa40
Activate next pane on before invoking onDidDestroy observers
Aug 28, 2014
a33706d
Add PaneContainer::onDidAddPaneItem and ::observePaneItems
Aug 28, 2014
acb9bda
Add pane and pane item observer methods to workspace. Also document.
Aug 28, 2014
70a23b0
Add Workspace::getPanes and ::getPaneItems
Aug 29, 2014
6c2bb26
Add Workspace::observeTextEditors and ::onDidAddTextEditor
Aug 29, 2014
c9e5ff6
Organize workspace API into sections. Add ::getActiveTextEditor
Aug 29, 2014
873818e
Deprecate string-based event subscriptions
Sep 3, 2014
87fb0b4
Deprecate theorist-provided behaviors in Pane
Sep 3, 2014
7ad992e
:lipstick:
Sep 3, 2014
a8c1f2d
Deprecate Workspace methods
Sep 3, 2014
c508f76
Upgrade event-kit for deprecated .off on subscriptions
Sep 3, 2014
67dc703
:lipstick: docs
Sep 3, 2014
f87f7c3
Kill a couple deprecation errors
Sep 3, 2014
83327ee
Don’t test for editor-created events when editor is copied
Sep 4, 2014
22c62b3
Replace ‘editor-created’ event with ::onDidAddTextEditor
Sep 4, 2014
db571a2
Avoid deprecation by calling ::getActivePaneItem
Sep 4, 2014
4946eec
Merge remote-tracking branch 'origin/master' into ns-simplify-events
Sep 4, 2014
0f912c9
Upgrade emissary to call prefer calling ::dispose in Subscriber mixin
Sep 4, 2014
57699e6
Use Workspace::getActivePane instead of property in spec
Sep 4, 2014
9de0ba1
Add Workspace::onDidOpen event subscription method
Sep 4, 2014
aac64e3
Document Workspace::onDidOpen
Sep 4, 2014
2f6f374
Upgrade event-kit to stop throwing when emitting on disposed emitters
Sep 4, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use Pane::setActiveItem internally so observers are invoked
  • Loading branch information
Nathan Sobo committed Aug 28, 2014
commit 40d93cd0cf0e61f77b9b408f3a0358125e57905a
6 changes: 3 additions & 3 deletions src/pane.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Pane extends Model
@emitter = new Emitter

@items = Sequence.fromArray(compact(params?.items ? []))
@activeItem ?= @items[0]
@setActiveItem(@items[0]) unless @getActiveItem()?

@subscribe @items.onEach (item) =>
if typeof item.on is 'function'
Expand Down Expand Up @@ -214,7 +214,7 @@ class Pane extends Model
@items.splice(index, 0, item)
@emit 'item-added', item, index
@emitter.emit 'did-add-item', {item, index}
@activeItem ?= item
@setActiveItem(item) unless @getActiveItem()?
item

# Public: Adds the given items to the pane.
Expand All @@ -236,7 +236,7 @@ class Pane extends Model
return if index is -1
if item is @activeItem
if @items.length is 1
@activeItem = undefined
@setActiveItem(undefined)
else if index is 0
@activateNextItem()
else
Expand Down