Skip to content

Instantly share code, notes, and snippets.

@ecoleman
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save ecoleman/50eed4879f02469a4e5b to your computer and use it in GitHub Desktop.

Select an option

Save ecoleman/50eed4879f02469a4e5b to your computer and use it in GitHub Desktop.

Revisions

  1. ecoleman renamed this gist Jul 17, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion gistfile1.txt → gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    // load the `gameState` param from localStorage and convert it from JSON to an object
    var game = JSON.parse(localStorage.getItem("gameState"));
    // after the above line, you can type `game` in your console to see what properties it has
  2. ecoleman created this gist Jul 17, 2014.
    13 changes: 13 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@

    // load the `gameState` param from localStorage and convert it from JSON to an object
    var game = JSON.parse(localStorage.getItem("gameState"));
    // after the above line, you can type `game` in your console to see what properties it has

    // change the `game.stores.wood` param to 15
    game.stores.wood = 15;

    // re-encode the game state into json and update localStorage
    localStorage.setItem("gameState", JSON.stringify(game));

    // reload the current window
    window.location.reload();