💄 docs

This commit is contained in:
Nathan Sobo
2014-09-03 16:46:53 -06:00
parent c508f76af0
commit 67dc703c18
2 changed files with 11 additions and 12 deletions

View File

@@ -84,6 +84,8 @@ class Pane extends Model
# Public: Invoke the given callback when the pane is destroyed.
#
# * `callback` {Function} to be called when the pane is destroyed.
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
onDidDestroy: (callback) ->
@emitter.on 'did-destroy', callback
@@ -148,6 +150,8 @@ class Pane extends Model
# Public: Invoke the given callback with all current and future items.
#
# * `callback` {Function} to be called with current and future items.
# * `item` An item that is present in {::getItems} at the time of
# subscription or that is added at some later time.
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
observeItems: (callback) ->
@@ -157,8 +161,7 @@ class Pane extends Model
# Public: Invoke the given callback when the value of {::getActiveItem}
# changes.
#
# * `callback` {Function} to be called with when the active item
# changes.
# * `callback` {Function} to be called with when the active item changes.
# * `activeItem` The current active item.
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.

View File

@@ -96,6 +96,8 @@ class Workspace extends Model
# workspace.
#
# * `callback` {Function} to be called with current and future panes.
# * `pane` A {Pane} that is present in {::getPanes} at the time of
# subscription or that is added at some later time.
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
observePanes: (callback) -> @paneContainer.observePanes(callback)
@@ -116,6 +118,8 @@ class Workspace extends Model
# the workspace.
#
# * `callback` {Function} to be called with current and future pane items.
# * `item` An item that is present in {::getPaneItems} at the time of
# subscription or that is added at some later time.
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
observePaneItems: (callback) -> @paneContainer.observePaneItems(callback)
@@ -139,28 +143,20 @@ class Workspace extends Model
# editors in the workspace.
#
# * `callback` {Function} to be called with current and future text editors.
# * `editor` An {Editor} that is present in {::getTextEditors} at the time
# of subscription or that is added at some later time.
#
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
observeTextEditors: (callback) ->
callback(textEditor) for textEditor in @getTextEditors()
@onDidAddTextEditor ({textEditor}) -> callback(textEditor)
# Deprecated: Register a function to be called for every current and future
# {Editor} in the workspace.
#
# * `callback` A {Function} with an {Editor} as its only argument.
#
# Returns a subscription object with an `.off` method that you can call to
# unregister the callback.
eachEditor: (callback) ->
deprecate("Use Workspace::observeTextEditors instead")
callback(editor) for editor in @getEditors()
@subscribe this, 'editor-created', (editor) -> callback(editor)
# Deprecated: Get all current editors in the workspace.
#
# Returns an {Array} of {Editor}s.
getEditors: ->
deprecate("Use Workspace::getTextEditors instead")