-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add save/load #1
Comments
Save/load requires a place to store data, and a way to represent data that can be reloaded later. Let's deal with a place to store data first. The easy way to store data is client-side. Storing data client-side can be done with cookies, but the amount of storage allowed is limited. More storage is available on clients via the Web storage API (use "local" not "session" mode); these are now widely supported. More info: A separate comment will focus on how to represent the data. |
Data representation in Javascript is often done with JSON, but that won't work directly. The data to be represented includes function definitions and recursive/cyclic object references; JSON supports neither. If all we needed was JSON+function function definitions, those are easy. Jsonfn at https://github.com/vkiryukhin/jsonfn shows how. (MIT license, Copyright (c) 2014 Vadim Kiryukhin ( vkiryukhin @ gmail.com )). In short:
That's not enough for cyclic references, though. A discussion on how to also deal with cyclic references is here: |
Add the ability to save/load games (stories) in progress.
The text was updated successfully, but these errors were encountered: