Fixed destroy to not break stopListening, which uses off.

This commit is contained in:
Scott Erickson 2014-03-24 14:27:10 -07:00
parent f55cef5ced
commit e9b3db2eb9
2 changed files with 7 additions and 3 deletions

View file

@ -1,7 +1,8 @@
# Template for classes with common functions, like hooking into the Mediator.
utils = require './utils'
classCount = 0
makeScopeName = -> "class-scope-#{classCount++}"
makeScopeName = -> "class-scope-#{classCount++}"
doNothing = ->
module.exports = class CocoClass
subscriptions: {}
@ -25,7 +26,8 @@ module.exports = class CocoClass
@stopListeningToShortcuts()
@[key] = undefined for key of @
@destroyed = true
@destroy = ->
@off = doNothing
@destroy = doNothing
# subscriptions

View file

@ -7,6 +7,7 @@ visibleModal = null
waitingModal = null
classCount = 0
makeScopeName = -> "view-scope-#{classCount++}"
doNothing = ->
module.exports = class CocoView extends Backbone.View
startsLoading: false
@ -45,7 +46,8 @@ module.exports = class CocoView extends Backbone.View
$('#modal-wrapper .modal').off 'hidden.bs.modal', @modalClosed
@[key] = undefined for key, value of @
@destroyed = true
@destroy = ->
@off = doNothing
@destroy = doNothing
afterInsert: ->