From e6362af7118081a2d5ea48e77a883f08186cb12e Mon Sep 17 00:00:00 2001 From: Corey Johnson & Nathan Sobo Date: Fri, 14 Dec 2012 16:38:04 -0800 Subject: [PATCH] Rename `subscription.destroy` to `subscription.cancel` --- spec/app/editor-spec.coffee | 3 ++- src/app/config.coffee | 2 +- src/stdlib/space-pen-extensions.coffee | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index f127fc7ce..8039409ef 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -515,7 +515,7 @@ describe "Editor", -> rootView.height(200) rootView.width(200) - config.update("editor.fontSize", 10) + config.update("editor.fontSize", fontSize) lineHeightBefore = editor.lineHeight charWidthBefore = editor.charWidth editor.setCursorScreenPosition [5, 6] @@ -1559,6 +1559,7 @@ describe "Editor", -> expect(editor.renderedLines.find('.line').text()).toBe "•a line with tabs▸ and spaces•¬" config.update("editor.showInvisibles", false) + config.update() expect(editor.renderedLines.find('.line').text()).toBe " a line with tabs and spaces " it "displays newlines(¬) as their own token outside of the other tokens scope", -> diff --git a/src/app/config.coffee b/src/app/config.coffee index 17a58d04b..4d7112fb5 100644 --- a/src/app/config.coffee +++ b/src/app/config.coffee @@ -65,7 +65,7 @@ class Config unless newValue == value value = newValue callback(value) - subscription = { destroy: => @off 'update', updateCallback } + subscription = { cancel: => @off 'update', updateCallback } @on 'update', updateCallback callback(value) subscription diff --git a/src/stdlib/space-pen-extensions.coffee b/src/stdlib/space-pen-extensions.coffee index 074e7388c..a1e4fd61c 100644 --- a/src/stdlib/space-pen-extensions.coffee +++ b/src/stdlib/space-pen-extensions.coffee @@ -10,14 +10,14 @@ _.extend View.prototype, subscribe: (eventEmitter, eventName, callback) -> eventEmitter.on eventName, callback - @addSubscription(destroy: -> eventEmitter.off eventName, callback) + @addSubscription(cancel: -> eventEmitter.off eventName, callback) addSubscription: (subscription) -> @subscriptions ?= [] @subscriptions.push(subscription) unsubscribe: -> - subscription.destroy() for subscription in @subscriptions ? [] + subscription.cancel() for subscription in @subscriptions ? [] remove: (args...) -> @unsubscribe()