Rename subscription.destroy to subscription.cancel

This commit is contained in:
Corey Johnson & Nathan Sobo 2012-12-14 16:38:04 -08:00
parent 54c0c277ed
commit e6362af711
3 changed files with 5 additions and 4 deletions

View File

@ -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", ->

View File

@ -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

View File

@ -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()