-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
35 lines (35 loc) · 1.21 KB
/
example.html
File metadata and controls
35 lines (35 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!doctype html>
<html>
<head>
<title>JSON to FileSystem and Back Again</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/padolsey/prettyPrint.js/master/prettyprint.js"></script>
<script type="text/javascript" src="giftwrap.js"></script>
<script type="text/javascript">
var jsonObject = {
letters: ["a", "b", "c", "d", "e", "f", "g"],
numbers: {
integer: 1235,
decimal: 50.4
}
};
$(document).ready(function() {
$(".existing-json").html(prettyPrint(jsonObject));
new GW.Present({persistent: true, onReady: function(jsonIo) {
jsonIo.writeObject(jsonObject, function () {
jsonIo.readObject(function() {
$(".read-json").html(prettyPrint(jsonIo.getObject()));
});
});
}});
});
</script>
</head>
<body>
<h1>FileSystem to JSON example usage</h1>
<h2>Object to be written to filesystem</h2>
<div class="existing-json"></div>
<h2>Object read from filesystem</h2>
<div class="read-json"></div>
</body>
</html>