From 62a31da72cfba2f115120b3ef8467b53d7baf732 Mon Sep 17 00:00:00 2001 From: Philipp Brumm Date: Wed, 25 May 2016 15:26:35 +0200 Subject: [PATCH] clean up title-bar element --- src/title-bar-element.coffee | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/title-bar-element.coffee b/src/title-bar-element.coffee index 24fa6091a..39deada10 100644 --- a/src/title-bar-element.coffee +++ b/src/title-bar-element.coffee @@ -10,21 +10,13 @@ class TitleBarElement extends HTMLElement @titleElement.textContent = document.title @appendChild @titleElement - @activeItemSubscription = atom.workspace.onDidChangeActivePaneItem (activeItem) => - @subscribeToActiveTextEditor() + @workspace.onDidChangeActivePaneItem => @updateTitle() + + @updateTitle() return this - subscribeToActiveTextEditor: -> - @cursorSubscription?.dispose() - @cursorSubscription = @getActiveTextEditor()?.onDidChangeTitle => - @updateTitle() - @updateTitle() - - updateTitle: -> + updateTitle: => @titleElement.textContent = document.title - getActiveTextEditor: -> - atom.workspace.getActiveTextEditor() - module.exports = TitleBarElement = document.registerElement 'atom-title-bar', prototype: TitleBarElement.prototype