mirror of
https://github.com/atom/atom.git
synced 2026-01-25 23:08:18 -05:00
🔥 Remove broken Dock::observeTextEditors(callback) fn
We're updating Atom to disallow editors in docks. As a result, we need
to remove Dock::observeTextEditors(callback). Normally, we would
deprecate a method before removing it, but this method is broken and has
never worked:
atom.workspace.getLeftDock().observeTextEditors(console.log)
(unknown) Uncaught TypeError: this.paneContainer.getTextEditors is not a function
at Dock.getTextEditors (/Applications/Atom.app/Contents/Resources/app/src/dock.js:590:37)
at Dock.observeTextEditors (/Applications/Atom.app/Contents/Resources/app/src/dock.js:396:41)
at <anonymous>:1:30
getTextEditors @ <embedded>:29933
observeTextEditors @ <embedded>:29739
(anonymous) @ VM1941:1
Since the method is broken, we know that nobody is relying on it.
Instead of deprecating the method, we can just remove it.
This commit is contained in:
15
src/dock.js
15
src/dock.js
@@ -385,21 +385,6 @@ module.exports = class Dock {
|
||||
Section: Event Subscription
|
||||
*/
|
||||
|
||||
// Essential: Invoke the given callback with all current and future text
|
||||
// editors in the dock.
|
||||
//
|
||||
// * `callback` {Function} to be called with current and future text editors.
|
||||
// * `editor` An {TextEditor} 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) {
|
||||
for (const textEditor of this.getTextEditors()) {
|
||||
callback(textEditor)
|
||||
}
|
||||
return this.onDidAddTextEditor(({textEditor}) => callback(textEditor))
|
||||
}
|
||||
|
||||
// Essential: Invoke the given callback with all current and future panes items
|
||||
// in the dock.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user