Saving settings

Posts: 4
Joined: Fri Dec 19, 2014 4:41 am

Saving settings

Postby pmallory » Tue Dec 23, 2014 6:50 am

I've written some functions to help save simulation settings. We won't really need this for awhile but maybe having it now will help inform the design of the front end. Check it out on github, feel free to comment.

The idea is that we can save objects (like the example in js/formData-stub.js) as JSON in localStorage and retrieve them by name.

example usage:

Code: Select all

> s = {one:1, two:2}
> SettingsSave.saveInputSettings('save1', s)
> SettingsSave.listSaveNames()
> SettingsSave.saveInputSettings('save2', s)
> SettingsSave.listSaveNames()
["save1", "save2"]
> SettingsSave.loadInputSetting('save2')
Object {one: 1, two: 2}
> SettingsSave.clear()

Return to “cFIREsim Open Source Project”

Who is online

Users browsing this forum: No registered users and 5 guests