Move eachEditor and getEditors to Workspace

This commit is contained in:
probablycorey
2014-02-12 17:19:25 -08:00
parent ee09eee374
commit 41761ffbcf
2 changed files with 14 additions and 9 deletions

View File

@@ -49,6 +49,18 @@ class Workspace extends Model
paneContainer: @paneContainer.serialize()
fullScreen: atom.isFullScreen()
# Public: Calls callback for every existing {Editor} and for all new {Editors}
# that are created.
#
# callback - A {Function} with an {Editor} as its only argument
eachEditor: (callback) ->
callback(editor) for editor in @getEditors()
@on 'editor-created', (editor) -> callback(editor)
# Public: Returns an {Array} of all open {Editor}s.
getEditors: ->
new Array(atom.project.editors...)
# Public: Asynchronously opens a given a filepath in Atom.
#
# uri - A {String} uri.