mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Add Pane::onWillRemoveItem event.
This commit is contained in:
@@ -163,6 +163,15 @@ class Pane extends Model
|
||||
onDidRemoveItem: (callback) ->
|
||||
@emitter.on 'did-remove-item', callback
|
||||
|
||||
# Public: Invoke the given callback before an item is removed from the pane.
|
||||
#
|
||||
# * `callback` {Function} to be called with when items are removed.
|
||||
# * `event` {Object} with the following keys:
|
||||
# * `item` The pane item to be removed.
|
||||
# * `index` {Number} indicating where the item is located.
|
||||
onWillRemoveItem: (callback) ->
|
||||
@emitter.on 'will-remove-item', callback
|
||||
|
||||
# Public: Invoke the given callback when an item is moved within the pane.
|
||||
#
|
||||
# * `callback` {Function} to be called with when items are moved.
|
||||
@@ -358,6 +367,8 @@ class Pane extends Model
|
||||
index = @items.indexOf(item)
|
||||
return if index is -1
|
||||
|
||||
@emitter.emit 'will-remove-item', {item, index, destroyed}
|
||||
|
||||
if Grim.includeDeprecatedAPIs and typeof item.on is 'function'
|
||||
@unsubscribe item
|
||||
@unsubscribeFromItem(item)
|
||||
|
||||
Reference in New Issue
Block a user