mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 16:17:57 -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
|
else
|
||||||
@load()
|
@load()
|
||||||
|
|
||||||
# Save latest level played in local storage
|
|
||||||
if localStorage?
|
|
||||||
localStorage["lastLevel"] = @levelID
|
|
||||||
|
|
||||||
onLevelLoadError: (e) =>
|
onLevelLoadError: (e) =>
|
||||||
application.router.navigate "/play?not_found=#{@levelID}", {trigger: true}
|
application.router.navigate "/play?not_found=#{@levelID}", {trigger: true}
|
||||||
|
|
||||||
|
@ -129,6 +125,10 @@ module.exports = class PlayLevelView extends View
|
||||||
super()
|
super()
|
||||||
|
|
||||||
onLevelLoaderLoaded: =>
|
onLevelLoaderLoaded: =>
|
||||||
|
# Save latest level played in local storage
|
||||||
|
if localStorage?
|
||||||
|
localStorage["lastLevel"] = @levelID
|
||||||
|
|
||||||
@session = @levelLoader.session
|
@session = @levelLoader.session
|
||||||
@world = @levelLoader.world
|
@world = @levelLoader.world
|
||||||
@level = @levelLoader.level
|
@level = @levelLoader.level
|
||||||
|
|
Loading…
Reference in a new issue