mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Unsubscribe correctly in subscribeToCommand
This commit is contained in:
@@ -7,7 +7,7 @@ module.exports =
|
||||
subscribeToCommand: (view, eventName, callback) ->
|
||||
view.command eventName, callback
|
||||
@subscriptions ?= []
|
||||
@subscriptions.push(cancel: -> view.off view, callback)
|
||||
@subscriptions.push(cancel: -> view.off eventName, callback)
|
||||
|
||||
unsubscribe: ->
|
||||
subscription.cancel() for subscription in @subscriptions ? []
|
||||
|
||||
Reference in New Issue
Block a user