VisezTrance

  • October 21, 2013 11:14 PM

    Persist javascript objects between pages

    By Daniel
    Some time ago I worked on a javascript game. One of the major issues I had to overcome, was that all my data would be gone on a page reload or when closing and opening the browser. I've been doing javascript for quite some time now, but I never gave this issue much thought until that time. After searching for a solution, I came out disappointed.

    I had an object named "game" that contained all the other objects, players, stars, galaxy and they all cross referenced each other (similar to any has many and belongs to associations). Ideally, this would be stored and rebuild on page load.

    So I came up with my own implementation, which I'll be open sourcing today: https://github.com/viseztrance/perseverance

    If you have any issue, feel free to mail me or open a ticket. However you may want to run the jasmine tests first.

    Tags:

    • JavaScript,
    • localStorage
  • Monthly Archives

    • October 2013 (2)
    • May 2012 (1)
    • October 2011 (1)
    • September 2011 (2)
    • March 2011 (3)
    • February 2011 (1)
    • January 2011 (1)
    • September 2010 (1)
    • August 2010 (1)
    • June 2010 (1)
    • April 2010 (1)
    • December 2009 (1)
    • October 2009 (1)
    • September 2009 (1)
    • August 2009 (1)
    • July 2009 (2)
    • April 2009 (2)
    • February 2009 (1)
    • January 2009 (2)
    • December 2008 (1)
    • October 2008 (1)
  • Pages

    • About / Contact

2008, © Daniel Mircea