mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
Removed all the setting properties to null in destroy methods that don't need them since destroy nullifies all properties.
This commit is contained in:
parent
53118984ff
commit
2c329a256f
17 changed files with 1 additions and 48 deletions
|
@ -232,9 +232,4 @@ module.exports = class LevelLoader extends CocoClass
|
||||||
Backbone.Mediator.publish 'level-loader:progress-changed', progress: @progress()
|
Backbone.Mediator.publish 'level-loader:progress-changed', progress: @progress()
|
||||||
@initWorld() if @allDone()
|
@initWorld() if @allDone()
|
||||||
@trigger 'progress'
|
@trigger 'progress'
|
||||||
@trigger 'loaded-all' if @progress() is 1
|
@trigger 'loaded-all' if @progress() is 1
|
||||||
|
|
||||||
destroy: ->
|
|
||||||
@world = null # don't hold onto garbage
|
|
||||||
@update = null
|
|
||||||
super()
|
|
|
@ -307,7 +307,6 @@ module.exports = class Camera extends CocoClass
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
createjs.Tween.removeTweens @
|
createjs.Tween.removeTweens @
|
||||||
@finishTween = null
|
|
||||||
super()
|
super()
|
||||||
|
|
||||||
onZoomTo: (pos, time) ->
|
onZoomTo: (pos, time) ->
|
||||||
|
|
|
@ -87,7 +87,6 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
||||||
mark.destroy() for name, mark of @marks
|
mark.destroy() for name, mark of @marks
|
||||||
label.destroy() for name, label of @labels
|
label.destroy() for name, label of @labels
|
||||||
@imageObject?.off 'animationend', @playNextAction
|
@imageObject?.off 'animationend', @playNextAction
|
||||||
@playNextAction = null
|
|
||||||
@displayObject?.off()
|
@displayObject?.off()
|
||||||
clearInterval @effectInterval if @effectInterval
|
clearInterval @effectInterval if @effectInterval
|
||||||
super()
|
super()
|
||||||
|
|
|
@ -100,12 +100,7 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
@stage.removeAllEventListeners()
|
@stage.removeAllEventListeners()
|
||||||
@stage.enableDOMEvents false
|
@stage.enableDOMEvents false
|
||||||
@stage.enableMouseOver 0
|
@stage.enableMouseOver 0
|
||||||
@onFramesScrubbed = null
|
|
||||||
@onMouseMove = null
|
|
||||||
@onMouseDown = null
|
|
||||||
@tick = null
|
|
||||||
@canvas.off 'mousewheel', @onMouseWheel
|
@canvas.off 'mousewheel', @onMouseWheel
|
||||||
@onMouseWheel = null
|
|
||||||
super()
|
super()
|
||||||
|
|
||||||
setWorld: (@world) ->
|
setWorld: (@world) ->
|
||||||
|
|
|
@ -42,7 +42,6 @@ module.exports = class CocoView extends Backbone.View
|
||||||
@stopListeningToShortcuts()
|
@stopListeningToShortcuts()
|
||||||
@undelegateEvents() # removes both events and subs
|
@undelegateEvents() # removes both events and subs
|
||||||
view.destroy() for id, view of @subviews
|
view.destroy() for id, view of @subviews
|
||||||
@modalClosed = null
|
|
||||||
$('#modal-wrapper .modal').off 'hidden.bs.modal', @modalClosed
|
$('#modal-wrapper .modal').off 'hidden.bs.modal', @modalClosed
|
||||||
@[key] = undefined for key, value of @
|
@[key] = undefined for key, value of @
|
||||||
@destroyed = true
|
@destroyed = true
|
||||||
|
|
|
@ -355,8 +355,6 @@ module.exports = class HUDView extends View
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
@stage?.stopTalking()
|
@stage?.stopTalking()
|
||||||
@addMoreMessage = null
|
|
||||||
@animateEnterButton = null
|
|
||||||
clearInterval(@messageInterval) if @messageInterval
|
clearInterval(@messageInterval) if @messageInterval
|
||||||
clearTimeout @hintNextSelectionTimeout if @hintNextSelectionTimeout
|
clearTimeout @hintNextSelectionTimeout if @hintNextSelectionTimeout
|
||||||
super()
|
super()
|
||||||
|
|
|
@ -123,5 +123,4 @@ module.exports = class LevelChatView extends View
|
||||||
destroy: ->
|
destroy: ->
|
||||||
key.deleteScope('level')
|
key.deleteScope('level')
|
||||||
clearInterval @clearOldMessagesInterval if @clearOldMessagesInterval
|
clearInterval @clearOldMessagesInterval if @clearOldMessagesInterval
|
||||||
@clearOldMessages = null
|
|
||||||
super()
|
super()
|
||||||
|
|
|
@ -221,7 +221,3 @@ module.exports = class PlaybackView extends View
|
||||||
me.set('music', not me.get('music'))
|
me.set('music', not me.get('music'))
|
||||||
me.save()
|
me.save()
|
||||||
$(document.activeElement).blur()
|
$(document.activeElement).blur()
|
||||||
|
|
||||||
destroy: ->
|
|
||||||
@onWindowResize = null
|
|
||||||
super()
|
|
||||||
|
|
|
@ -94,9 +94,3 @@ module.exports = class CastButtonView extends View
|
||||||
spell.view.setAutocastDelay delay for spellKey, spell of @spells
|
spell.view.setAutocastDelay delay for spellKey, spell of @spells
|
||||||
@castOptions.find('a').each ->
|
@castOptions.find('a').each ->
|
||||||
$(@).toggleClass('selected', parseInt($(@).attr('data-delay')) is delay)
|
$(@).toggleClass('selected', parseInt($(@).attr('data-delay')) is delay)
|
||||||
|
|
||||||
destroy: ->
|
|
||||||
@castButton.off 'click', @onCastButtonClick
|
|
||||||
@castOptions.find('a').off 'click', @onCastOptionsClick
|
|
||||||
@onCastOptionsClick = null
|
|
||||||
super()
|
|
||||||
|
|
|
@ -162,5 +162,4 @@ module.exports = class DebugView extends View
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
@ace?.removeEventListener "mousemove", @onMouseMove
|
@ace?.removeEventListener "mousemove", @onMouseMove
|
||||||
@onMouseMove = null
|
|
||||||
super()
|
super()
|
||||||
|
|
|
@ -108,5 +108,4 @@ module.exports = class SpellListEntryView extends View
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
@avatar?.destroy()
|
@avatar?.destroy()
|
||||||
@hideThangs = null
|
|
||||||
super()
|
super()
|
||||||
|
|
|
@ -93,5 +93,4 @@ module.exports = class SpellListView extends View
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
entry.destroy() for entry in @entries
|
entry.destroy() for entry in @entries
|
||||||
@sortScoreForSpell = null
|
|
||||||
super()
|
super()
|
|
@ -575,13 +575,7 @@ module.exports = class SpellView extends View
|
||||||
@firepad?.dispose()
|
@firepad?.dispose()
|
||||||
@ace?.commands.removeCommand command for command in @aceCommands
|
@ace?.commands.removeCommand command for command in @aceCommands
|
||||||
@ace?.destroy()
|
@ace?.destroy()
|
||||||
@ace = null
|
|
||||||
@aceDoc?.off 'change', @onCodeChangeMetaHandler
|
@aceDoc?.off 'change', @onCodeChangeMetaHandler
|
||||||
@aceDoc = null
|
|
||||||
@aceSession?.selection.off 'changeCursor', @onCursorActivity
|
@aceSession?.selection.off 'changeCursor', @onCursorActivity
|
||||||
@aceSession = null
|
|
||||||
@debugView?.destroy()
|
@debugView?.destroy()
|
||||||
@spell = null
|
|
||||||
for fat in ['notifySpellChanged', 'notifyEditingEnded', 'notifyEditingBegan', 'onFirepadLoaded', 'onLoaded', 'toggleBackground', 'setRecompileNeeded', 'onCursorActivity', 'highlightCurrentLine', 'updateAether', 'onCodeChangeMetaHandler', 'recompileIfNeeded', 'currentAutocastHandler']
|
|
||||||
@[fat] = null
|
|
||||||
super()
|
super()
|
||||||
|
|
|
@ -83,6 +83,5 @@ module.exports = class ThangListView extends View
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
entry.destroy() for entry in @entries
|
entry.destroy() for entry in @entries
|
||||||
@sortScoreForThang = null
|
|
||||||
super()
|
super()
|
||||||
|
|
||||||
|
|
|
@ -219,5 +219,4 @@ module.exports = class TomeView extends View
|
||||||
destroy: ->
|
destroy: ->
|
||||||
spell.destroy() for spellKey, spell of @spells
|
spell.destroy() for spellKey, spell of @spells
|
||||||
@worker?._close()
|
@worker?._close()
|
||||||
@worker = null
|
|
||||||
super()
|
super()
|
||||||
|
|
|
@ -472,9 +472,4 @@ module.exports = class PlayLevelView extends View
|
||||||
@bus?.destroy()
|
@bus?.destroy()
|
||||||
#@instance.save() unless @instance.loading
|
#@instance.save() unless @instance.loading
|
||||||
console.profileEnd?() if PROFILE_ME
|
console.profileEnd?() if PROFILE_ME
|
||||||
@onLevelLoadError = null
|
|
||||||
@onLevelLoaderLoaded = null
|
|
||||||
@onSupermodelLoadedOne = null
|
|
||||||
@preloadNextLevel = null
|
|
||||||
@saveScreenshot = null
|
|
||||||
super()
|
super()
|
||||||
|
|
|
@ -476,9 +476,4 @@ module.exports = class SpectateLevelView extends View
|
||||||
delete window.world # not sure where this is set, but this is one way to clean it up
|
delete window.world # not sure where this is set, but this is one way to clean it up
|
||||||
clearInterval(@pointerInterval)
|
clearInterval(@pointerInterval)
|
||||||
console.profileEnd?() if PROFILE_ME
|
console.profileEnd?() if PROFILE_ME
|
||||||
@onLevelLoadError = null
|
|
||||||
@onLevelLoaderLoaded = null
|
|
||||||
@onSupermodelLoadedOne = null
|
|
||||||
@preloadNextLevel = null
|
|
||||||
@saveScreenshot = null
|
|
||||||
super()
|
super()
|
||||||
|
|
Loading…
Reference in a new issue