mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Rename subscription.destroy to subscription.cancel
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user