From 2c329a256fa0430793fd4b51e5dcd7bb9ce90b01 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Mon, 24 Mar 2014 14:42:56 -0700 Subject: [PATCH] Removed all the setting properties to null in destroy methods that don't need them since destroy nullifies all properties. --- app/lib/LevelLoader.coffee | 7 +------ app/lib/surface/Camera.coffee | 1 - app/lib/surface/CocoSprite.coffee | 1 - app/lib/surface/Surface.coffee | 5 ----- app/views/kinds/CocoView.coffee | 1 - app/views/play/level/hud_view.coffee | 2 -- app/views/play/level/level_chat_view.coffee | 1 - app/views/play/level/playback_view.coffee | 4 ---- app/views/play/level/tome/cast_button_view.coffee | 6 ------ app/views/play/level/tome/spell_debug_view.coffee | 1 - app/views/play/level/tome/spell_list_entry_view.coffee | 1 - app/views/play/level/tome/spell_list_view.coffee | 1 - app/views/play/level/tome/spell_view.coffee | 6 ------ app/views/play/level/tome/thang_list_view.coffee | 1 - app/views/play/level/tome/tome_view.coffee | 1 - app/views/play/level_view.coffee | 5 ----- app/views/play/spectate_view.coffee | 5 ----- 17 files changed, 1 insertion(+), 48 deletions(-) diff --git a/app/lib/LevelLoader.coffee b/app/lib/LevelLoader.coffee index ce842fbd0..34ff1bafb 100644 --- a/app/lib/LevelLoader.coffee +++ b/app/lib/LevelLoader.coffee @@ -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 \ No newline at end of file diff --git a/app/lib/surface/Camera.coffee b/app/lib/surface/Camera.coffee index 7240c3c88..766fe1f74 100644 --- a/app/lib/surface/Camera.coffee +++ b/app/lib/surface/Camera.coffee @@ -307,7 +307,6 @@ module.exports = class Camera extends CocoClass destroy: -> createjs.Tween.removeTweens @ - @finishTween = null super() onZoomTo: (pos, time) -> diff --git a/app/lib/surface/CocoSprite.coffee b/app/lib/surface/CocoSprite.coffee index d574734fc..1b7252f9e 100644 --- a/app/lib/surface/CocoSprite.coffee +++ b/app/lib/surface/CocoSprite.coffee @@ -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() diff --git a/app/lib/surface/Surface.coffee b/app/lib/surface/Surface.coffee index 675e57b0f..94d80d269 100644 --- a/app/lib/surface/Surface.coffee +++ b/app/lib/surface/Surface.coffee @@ -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) -> diff --git a/app/views/kinds/CocoView.coffee b/app/views/kinds/CocoView.coffee index 0a688be72..0c13c5f8d 100644 --- a/app/views/kinds/CocoView.coffee +++ b/app/views/kinds/CocoView.coffee @@ -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 diff --git a/app/views/play/level/hud_view.coffee b/app/views/play/level/hud_view.coffee index ed3403925..810092493 100644 --- a/app/views/play/level/hud_view.coffee +++ b/app/views/play/level/hud_view.coffee @@ -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() diff --git a/app/views/play/level/level_chat_view.coffee b/app/views/play/level/level_chat_view.coffee index 2963c9b74..09936ae65 100644 --- a/app/views/play/level/level_chat_view.coffee +++ b/app/views/play/level/level_chat_view.coffee @@ -123,5 +123,4 @@ module.exports = class LevelChatView extends View destroy: -> key.deleteScope('level') clearInterval @clearOldMessagesInterval if @clearOldMessagesInterval - @clearOldMessages = null super() diff --git a/app/views/play/level/playback_view.coffee b/app/views/play/level/playback_view.coffee index 26a9058f5..0005520ae 100644 --- a/app/views/play/level/playback_view.coffee +++ b/app/views/play/level/playback_view.coffee @@ -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() diff --git a/app/views/play/level/tome/cast_button_view.coffee b/app/views/play/level/tome/cast_button_view.coffee index b3c9eb7e6..5b2f0e094 100644 --- a/app/views/play/level/tome/cast_button_view.coffee +++ b/app/views/play/level/tome/cast_button_view.coffee @@ -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() diff --git a/app/views/play/level/tome/spell_debug_view.coffee b/app/views/play/level/tome/spell_debug_view.coffee index c35314932..32f7b0182 100644 --- a/app/views/play/level/tome/spell_debug_view.coffee +++ b/app/views/play/level/tome/spell_debug_view.coffee @@ -162,5 +162,4 @@ module.exports = class DebugView extends View destroy: -> @ace?.removeEventListener "mousemove", @onMouseMove - @onMouseMove = null super() diff --git a/app/views/play/level/tome/spell_list_entry_view.coffee b/app/views/play/level/tome/spell_list_entry_view.coffee index 48820d742..7f72cab5d 100644 --- a/app/views/play/level/tome/spell_list_entry_view.coffee +++ b/app/views/play/level/tome/spell_list_entry_view.coffee @@ -108,5 +108,4 @@ module.exports = class SpellListEntryView extends View destroy: -> @avatar?.destroy() - @hideThangs = null super() diff --git a/app/views/play/level/tome/spell_list_view.coffee b/app/views/play/level/tome/spell_list_view.coffee index 137219c96..d4ab72157 100644 --- a/app/views/play/level/tome/spell_list_view.coffee +++ b/app/views/play/level/tome/spell_list_view.coffee @@ -93,5 +93,4 @@ module.exports = class SpellListView extends View destroy: -> entry.destroy() for entry in @entries - @sortScoreForSpell = null super() \ No newline at end of file diff --git a/app/views/play/level/tome/spell_view.coffee b/app/views/play/level/tome/spell_view.coffee index 5e055ac3c..e55e03210 100644 --- a/app/views/play/level/tome/spell_view.coffee +++ b/app/views/play/level/tome/spell_view.coffee @@ -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() diff --git a/app/views/play/level/tome/thang_list_view.coffee b/app/views/play/level/tome/thang_list_view.coffee index b1c061f20..a2271f146 100644 --- a/app/views/play/level/tome/thang_list_view.coffee +++ b/app/views/play/level/tome/thang_list_view.coffee @@ -83,6 +83,5 @@ module.exports = class ThangListView extends View destroy: -> entry.destroy() for entry in @entries - @sortScoreForThang = null super() diff --git a/app/views/play/level/tome/tome_view.coffee b/app/views/play/level/tome/tome_view.coffee index 68ca029bf..140336419 100644 --- a/app/views/play/level/tome/tome_view.coffee +++ b/app/views/play/level/tome/tome_view.coffee @@ -219,5 +219,4 @@ module.exports = class TomeView extends View destroy: -> spell.destroy() for spellKey, spell of @spells @worker?._close() - @worker = null super() diff --git a/app/views/play/level_view.coffee b/app/views/play/level_view.coffee index ff88a90c5..083d99cb0 100644 --- a/app/views/play/level_view.coffee +++ b/app/views/play/level_view.coffee @@ -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() diff --git a/app/views/play/spectate_view.coffee b/app/views/play/spectate_view.coffee index b0a8a4379..da6f5e611 100644 --- a/app/views/play/spectate_view.coffee +++ b/app/views/play/spectate_view.coffee @@ -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()