mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 10:06:08 -05:00
Trigger storage of latest level only after the level is guaranteed to be able to load
This commit is contained in:
parent
bb76fb241c
commit
514fe358c1
1 changed files with 4 additions and 4 deletions
|
@ -92,10 +92,6 @@ module.exports = class PlayLevelView extends View
|
|||
else
|
||||
@load()
|
||||
|
||||
# Save latest level played in local storage
|
||||
if localStorage?
|
||||
localStorage["lastLevel"] = @levelID
|
||||
|
||||
onLevelLoadError: (e) =>
|
||||
application.router.navigate "/play?not_found=#{@levelID}", {trigger: true}
|
||||
|
||||
|
@ -129,6 +125,10 @@ module.exports = class PlayLevelView extends View
|
|||
super()
|
||||
|
||||
onLevelLoaderLoaded: =>
|
||||
# Save latest level played in local storage
|
||||
if localStorage?
|
||||
localStorage["lastLevel"] = @levelID
|
||||
|
||||
@session = @levelLoader.session
|
||||
@world = @levelLoader.world
|
||||
@level = @levelLoader.level
|
||||
|
|
Loading…
Reference in a new issue