source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/editor/js/Config.js@ 28897

Last change on this file since 28897 was 28897, checked in by davidb, 10 years ago

GUI front-end to server base plus web page content

File size: 750 bytes
Line 
1var Config = function () {
2
3 var name = 'threejs-editor';
4
5 var storage = {
6 theme: 'css/light.css',
7 camera: {
8 position: [ 500, 250, 500 ],
9 target: [ 0, 0, 0 ]
10 }
11 };
12
13 if ( window.localStorage[ name ] !== undefined ) {
14
15 var data = JSON.parse( window.localStorage[ name ] );
16
17 for ( var key in data ) {
18
19 storage[ key ] = data[ key ];
20
21 }
22
23 }
24
25 return {
26
27 getKey: function ( key ) {
28
29 return storage[ key ];
30
31 },
32
33 setKey: function ( key, value ) {
34
35 storage[ key ] = value;
36
37 window.localStorage[ name ] = JSON.stringify( storage );
38
39 console.log( '[' + /\d\d\:\d\d\:\d\d/.exec( new Date() )[ 0 ] + ']', 'Saved config to LocalStorage.' );
40
41 },
42
43 clear: function () {
44
45 delete window.localStorage[ name ];
46
47 }
48
49 }
50
51};
Note: See TracBrowser for help on using the repository browser.