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()
|
||||
@initWorld() if @allDone()
|
||||
@trigger 'progress'
|
||||
@trigger 'loaded-all' if @progress() is 1
|
||||
|
||||
destroy: ->
|
||||
@world = null # don't hold onto garbage
|
||||
@update = null
|
||||
super()
|
||||
@trigger 'loaded-all' if @progress() is 1
|
|
@ -307,7 +307,6 @@ module.exports = class Camera extends CocoClass
|
|||
|
||||
destroy: ->
|
||||
createjs.Tween.removeTweens @
|
||||
@finishTween = null
|
||||
super()
|
||||
|
||||
onZoomTo: (pos, time) ->
|
||||
|
|
|
@ -87,7 +87,6 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
mark.destroy() for name, mark of @marks
|
||||
label.destroy() for name, label of @labels
|
||||
@imageObject?.off 'animationend', @playNextAction
|
||||
@playNextAction = null
|
||||
@displayObject?.off()
|
||||
clearInterval @effectInterval if @effectInterval
|
||||
super()
|
||||
|
|
|
@ -100,12 +100,7 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
@stage.removeAllEventListeners()
|
||||
@stage.enableDOMEvents false
|
||||
@stage.enableMouseOver 0
|
||||
@onFramesScrubbed = null
|
||||
@onMouseMove = null
|
||||
@onMouseDown = null
|
||||
@tick = null
|
||||
@canvas.off 'mousewheel', @onMouseWheel
|
||||
@onMouseWheel = null
|
||||
super()
|
||||
|
||||
setWorld: (@world) ->
|
||||
|
|
|
@ -42,7 +42,6 @@ module.exports = class CocoView extends Backbone.View
|
|||
@stopListeningToShortcuts()
|
||||
@undelegateEvents() # removes both events and subs
|
||||
view.destroy() for id, view of @subviews
|
||||
@modalClosed = null
|
||||
$('#modal-wrapper .modal').off 'hidden.bs.modal', @modalClosed
|
||||
@[key] = undefined for key, value of @
|
||||
@destroyed = true
|
||||
|
|
|
@ -355,8 +355,6 @@ module.exports = class HUDView extends View
|
|||
|
||||
destroy: ->
|
||||
@stage?.stopTalking()
|
||||
@addMoreMessage = null
|
||||
@animateEnterButton = null
|
||||
clearInterval(@messageInterval) if @messageInterval
|
||||
clearTimeout @hintNextSelectionTimeout if @hintNextSelectionTimeout
|
||||
super()
|
||||
|
|
|
@ -123,5 +123,4 @@ module.exports = class LevelChatView extends View
|
|||
destroy: ->
|
||||
key.deleteScope('level')
|
||||
clearInterval @clearOldMessagesInterval if @clearOldMessagesInterval
|
||||
@clearOldMessages = null
|
||||
super()
|
||||
|
|
|
@ -221,7 +221,3 @@ module.exports = class PlaybackView extends View
|
|||
me.set('music', not me.get('music'))
|
||||
me.save()
|
||||
$(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
|
||||
@castOptions.find('a').each ->
|
||||
$(@).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: ->
|
||||
@ace?.removeEventListener "mousemove", @onMouseMove
|
||||
@onMouseMove = null
|
||||
super()
|
||||
|
|
|
@ -108,5 +108,4 @@ module.exports = class SpellListEntryView extends View
|
|||
|
||||
destroy: ->
|
||||
@avatar?.destroy()
|
||||
@hideThangs = null
|
||||
super()
|
||||
|
|
|
@ -93,5 +93,4 @@ module.exports = class SpellListView extends View
|
|||
|
||||
destroy: ->
|
||||
entry.destroy() for entry in @entries
|
||||
@sortScoreForSpell = null
|
||||
super()
|
|
@ -575,13 +575,7 @@ module.exports = class SpellView extends View
|
|||
@firepad?.dispose()
|
||||
@ace?.commands.removeCommand command for command in @aceCommands
|
||||
@ace?.destroy()
|
||||
@ace = null
|
||||
@aceDoc?.off 'change', @onCodeChangeMetaHandler
|
||||
@aceDoc = null
|
||||
@aceSession?.selection.off 'changeCursor', @onCursorActivity
|
||||
@aceSession = null
|
||||
@debugView?.destroy()
|
||||
@spell = null
|
||||
for fat in ['notifySpellChanged', 'notifyEditingEnded', 'notifyEditingBegan', 'onFirepadLoaded', 'onLoaded', 'toggleBackground', 'setRecompileNeeded', 'onCursorActivity', 'highlightCurrentLine', 'updateAether', 'onCodeChangeMetaHandler', 'recompileIfNeeded', 'currentAutocastHandler']
|
||||
@[fat] = null
|
||||
super()
|
||||
|
|
|
@ -83,6 +83,5 @@ module.exports = class ThangListView extends View
|
|||
|
||||
destroy: ->
|
||||
entry.destroy() for entry in @entries
|
||||
@sortScoreForThang = null
|
||||
super()
|
||||
|
||||
|
|
|
@ -219,5 +219,4 @@ module.exports = class TomeView extends View
|
|||
destroy: ->
|
||||
spell.destroy() for spellKey, spell of @spells
|
||||
@worker?._close()
|
||||
@worker = null
|
||||
super()
|
||||
|
|
|
@ -472,9 +472,4 @@ module.exports = class PlayLevelView extends View
|
|||
@bus?.destroy()
|
||||
#@instance.save() unless @instance.loading
|
||||
console.profileEnd?() if PROFILE_ME
|
||||
@onLevelLoadError = null
|
||||
@onLevelLoaderLoaded = null
|
||||
@onSupermodelLoadedOne = null
|
||||
@preloadNextLevel = null
|
||||
@saveScreenshot = null
|
||||
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
|
||||
clearInterval(@pointerInterval)
|
||||
console.profileEnd?() if PROFILE_ME
|
||||
@onLevelLoadError = null
|
||||
@onLevelLoaderLoaded = null
|
||||
@onSupermodelLoadedOne = null
|
||||
@preloadNextLevel = null
|
||||
@saveScreenshot = null
|
||||
super()
|
||||
|
|
Loading…
Reference in a new issue