|
525
|
1 |
<!DOCTYPE html> |
|
|
2 |
<html lang="en"> |
|
|
3 |
<head> |
|
|
4 |
<meta charset="utf-8"> |
|
|
5 |
<title>Example: Rebuilding Class Instances from JSON Data</title> |
|
|
6 |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic"> |
|
|
7 |
<link rel="stylesheet" href="../../build/cssgrids/cssgrids-min.css"> |
|
|
8 |
<link rel="stylesheet" href="../assets/css/main.css"> |
|
|
9 |
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css"> |
|
|
10 |
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png"> |
|
|
11 |
<script src="../../build/yui/yui-min.js"></script> |
|
|
12 |
|
|
|
13 |
</head> |
|
|
14 |
<body> |
|
|
15 |
<!-- |
|
|
16 |
<a href="https://github.com/yui/yui3"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a> |
|
|
17 |
--> |
|
|
18 |
<div id="doc"> |
|
|
19 |
<div id="hd"> |
|
|
20 |
<h1><img src="http://yuilibrary.com/img/yui-logo.png"></h1> |
|
|
21 |
</div> |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
<h1>Example: Rebuilding Class Instances from JSON Data</h1> |
|
|
25 |
<div class="yui3-g"> |
|
|
26 |
<div class="yui3-u-3-4"> |
|
|
27 |
<div id="main"> |
|
|
28 |
<div class="content"><div class="intro"> |
|
|
29 |
<p>This example illustrates one method of serializing and recreating class instances by using the <code>replacer</code> and <code>reviver</code> parameters to <code>JSON.stringify</code> and <code>JSON.parse</code> respectively.</p> |
|
|
30 |
</div> |
|
|
31 |
|
|
|
32 |
<div class="example yui3-skin-sam"> |
|
|
33 |
<style scoped> |
|
|
34 |
#demo pre { |
|
|
35 |
background: #fff; |
|
|
36 |
border: 1px solid #ccc; |
|
|
37 |
margin: 1em; |
|
|
38 |
padding: 1em; |
|
|
39 |
white-space: pre-wrap; /* css-3 */ |
|
|
40 |
word-wrap: break-word; /* Internet Explorer 5.5+ */ |
|
|
41 |
} |
|
|
42 |
</style> |
|
|
43 |
|
|
|
44 |
<div id="demo"> |
|
|
45 |
<input type="button" id="demo_freeze" value="Freeze"> |
|
|
46 |
<input type="button" id="demo_thaw" disabled="disabled" value="Thaw"> |
|
|
47 |
<pre id="demo_frozen">(stringify results here)</pre> |
|
|
48 |
<div id="demo_thawed"></div> |
|
|
49 |
</div> |
|
|
50 |
|
|
|
51 |
<script type="text/javascript"> |
|
|
52 |
YUI().use("node", "json", function(Y) { |
|
|
53 |
|
|
|
54 |
var example = { |
|
|
55 |
data : null, |
|
|
56 |
jsonString : null, |
|
|
57 |
|
|
|
58 |
dateRE : /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?Z$/, |
|
|
59 |
|
|
|
60 |
cryo : function (k,o) { |
|
|
61 |
return (o instanceof CaveMan) ? CaveMan.freeze(o) : o; |
|
|
62 |
}, |
|
|
63 |
revive : function (k,v) { |
|
|
64 |
// Turn anything that looks like a UTC date string into a Date instance |
|
|
65 |
var match = Y.Lang.isString(v) ? v.match(example.dateRE) : null, |
|
|
66 |
d; |
|
|
67 |
|
|
|
68 |
if (match) { |
|
|
69 |
d = new Date(); |
|
|
70 |
d.setUTCFullYear(match[1], (match[2] - 1), match[3]); |
|
|
71 |
d.setUTCHours(match[4], match[5], match[6]); |
|
|
72 |
return d; |
|
|
73 |
} |
|
|
74 |
// Check for cavemen by the _class key |
|
|
75 |
if (v instanceof Object && v._class == 'CaveMan') { |
|
|
76 |
return CaveMan.thaw(v); |
|
|
77 |
} |
|
|
78 |
// default to returning the value unaltered |
|
|
79 |
return v; |
|
|
80 |
} |
|
|
81 |
}; |
|
|
82 |
|
|
|
83 |
function CaveMan(name,discovered) { |
|
|
84 |
this.name = name; |
|
|
85 |
this.discovered = discovered; |
|
|
86 |
}; |
|
|
87 |
CaveMan.prototype.getName = function () { |
|
|
88 |
return this.name + ", the cave man"; |
|
|
89 |
} |
|
|
90 |
|
|
|
91 |
// Static methods to convert to and from a basic object structure |
|
|
92 |
CaveMan.thaw = function (o) { |
|
|
93 |
return new CaveMan(o.n, o.d); |
|
|
94 |
}; |
|
|
95 |
// Convert to a basic object structure including a class identifier |
|
|
96 |
CaveMan.freeze = function (cm) { |
|
|
97 |
return { |
|
|
98 |
_class : 'CaveMan', |
|
|
99 |
n : cm.name, |
|
|
100 |
d : cm.discovered // remains a Date for standard JSON serialization |
|
|
101 |
}; |
|
|
102 |
}; |
|
|
103 |
|
|
|
104 |
example.data = { |
|
|
105 |
count : 1, |
|
|
106 |
type : 'Hominid', |
|
|
107 |
specimen : [ |
|
|
108 |
new CaveMan('Ed',new Date(1946,6,6)) |
|
|
109 |
] |
|
|
110 |
}; |
|
|
111 |
|
|
|
112 |
Y.one('#demo_freeze').on('click',function (e) { |
|
|
113 |
// Format the string with 4 space indentation |
|
|
114 |
example.jsonString = Y.JSON.stringify(example.data, example.cryo, 4); |
|
|
115 |
|
|
|
116 |
Y.one('#demo_frozen').set('text', example.jsonString); |
|
|
117 |
Y.one('#demo_thaw').set('disabled',false); |
|
|
118 |
}); |
|
|
119 |
|
|
|
120 |
Y.one('#demo_thaw').on('click',function (e) { |
|
|
121 |
var parsedData = Y.JSON.parse(example.jsonString, example.revive); |
|
|
122 |
cm = parsedData.specimen[0]; |
|
|
123 |
|
|
|
124 |
Y.one('#demo_thawed').set('innerHTML', |
|
|
125 |
"<p>Specimen count: " + parsedData.count + "</p>"+ |
|
|
126 |
"<p>Specimen type: " + parsedData.type + "</p>"+ |
|
|
127 |
"<p>Instanceof CaveMan: " + (cm instanceof CaveMan) + "</p>"+ |
|
|
128 |
"<p>Name: " + cm.getName() + "</p>"+ |
|
|
129 |
"<p>Discovered: " + cm.discovered + "</p>"); |
|
|
130 |
}); |
|
|
131 |
|
|
|
132 |
// Expose the example objects for inspection |
|
|
133 |
example.CaveMan = CaveMan; |
|
|
134 |
YUI.example = example; |
|
|
135 |
|
|
|
136 |
}); |
|
|
137 |
</script> |
|
|
138 |
|
|
|
139 |
</div> |
|
|
140 |
|
|
|
141 |
<h3>The CaveMan class</h3> |
|
|
142 |
<p>For this example, we'll use a class CaveMan, with a property <code>discovered</code> that holds a <code>Date</code> instance, and a method <code>getName</code>.</p> |
|
|
143 |
|
|
|
144 |
<pre class="code prettyprint">YUI().use("node", "json", function(Y) { |
|
|
145 |
|
|
|
146 |
function CaveMan(name,discovered) { |
|
|
147 |
this.name = name; |
|
|
148 |
this.discovered = discovered; |
|
|
149 |
}; |
|
|
150 |
CaveMan.prototype.getName = function () { |
|
|
151 |
return this.name + ", the cave man"; |
|
|
152 |
} |
|
|
153 |
|
|
|
154 |
...</pre> |
|
|
155 |
|
|
|
156 |
|
|
|
157 |
<h3>Add <code>freeze</code> and <code>thaw</code> static methods</h3> |
|
|
158 |
<p>We'll add the methods responsible for serializing and reconstituting instances to the CaveMan class as static methods.</p> |
|
|
159 |
|
|
|
160 |
<pre class="code prettyprint">// Static method to convert to a basic structure with a class identifier |
|
|
161 |
CaveMan.freeze = function (cm) { |
|
|
162 |
return { |
|
|
163 |
_class : 'CaveMan', |
|
|
164 |
n : cm.name, |
|
|
165 |
d : cm.discovered // remains a Date for standard JSON serialization |
|
|
166 |
}; |
|
|
167 |
}; |
|
|
168 |
|
|
|
169 |
// Static method to reconstitute a CaveMan from the basic structure |
|
|
170 |
CaveMan.thaw = function (o) { |
|
|
171 |
return new CaveMan(o.n, o.d); |
|
|
172 |
};</pre> |
|
|
173 |
|
|
|
174 |
|
|
|
175 |
<h3>Reference the methods in replacer and reviver functions</h3> |
|
|
176 |
<p>We'll create an <code>example</code> namespace to hold our moving parts. In it, we'll add a method to pass to <code>JSON.stringify</code> that calls our custom serializer, and another method to pass to <code>JSON.parse</code> that detects the serialized structure and calls our thawing method.</p> |
|
|
177 |
|
|
|
178 |
<pre class="code prettyprint">var example = { |
|
|
179 |
cryo : function (k,o) { |
|
|
180 |
return (o instanceof CaveMan) ? CaveMan.freeze(o) : o; |
|
|
181 |
}, |
|
|
182 |
|
|
|
183 |
revive : function (k,v) { |
|
|
184 |
// Check for cavemen by the _class key |
|
|
185 |
if (v instanceof Object && v._class == 'CaveMan') { |
|
|
186 |
return CaveMan.thaw(v); |
|
|
187 |
} |
|
|
188 |
// default to returning the value unaltered |
|
|
189 |
return v; |
|
|
190 |
} |
|
|
191 |
};</pre> |
|
|
192 |
|
|
|
193 |
|
|
|
194 |
<h3>The data to be serialized</h3> |
|
|
195 |
<p>We'll create a CaveMan instance and nest it in another object structure to illustrate how the thawing process still operates normally for all other data.</p> |
|
|
196 |
<pre class="code prettyprint">example.data = { |
|
|
197 |
count : 1, |
|
|
198 |
type : 'Hominid', |
|
|
199 |
specimen : [ |
|
|
200 |
new CaveMan('Ed',new Date(1946,6,6)) |
|
|
201 |
] |
|
|
202 |
};</pre> |
|
|
203 |
|
|
|
204 |
|
|
|
205 |
<h3>Thawing from the inside out and the <code>Date</code> instance</h3> |
|
|
206 |
<p>The reviver function passed to <code>JSON.parse</code> is applied to all key:value pairs in the raw parsed object from the deepest keys to the highest level. In our case, this means that the <code>name</code> and <code>discovered</code> properties will be passed through the reviver, and <em>then</em> the object containing those keys will be passed through.</p> |
|
|
207 |
<p>We'll take advantage of this by watching for UTC formatted date strings (the default JSON serialization for Dates) and reviving them into proper <code>Date</code> instances before the containing object gets its turn in the reviver.</p> |
|
|
208 |
|
|
|
209 |
<pre class="code prettyprint">var example = { |
|
|
210 |
dateRE : /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?Z$/, |
|
|
211 |
|
|
|
212 |
cryo : function (k,o) { |
|
|
213 |
return (o instanceof CaveMan) ? CaveMan.freeze(o) : o; |
|
|
214 |
}, |
|
|
215 |
revive : function (k,v) { |
|
|
216 |
// Turn anything that looks like a UTC date string into a Date instance |
|
|
217 |
var match = Y.Lang.isString(v) ? v.match(example.dateRE) : null, |
|
|
218 |
d; |
|
|
219 |
|
|
|
220 |
if (match) { |
|
|
221 |
d = new Date(); |
|
|
222 |
d.setUTCFullYear(match[1], (match[2] - 1), match[3]); |
|
|
223 |
d.setUTCHours(match[4], match[5], match[6]); |
|
|
224 |
return d; |
|
|
225 |
} |
|
|
226 |
// Check for cavemen by the _class key |
|
|
227 |
if (v instanceof Object && v._class == 'CaveMan') { |
|
|
228 |
return CaveMan.thaw(v); |
|
|
229 |
} |
|
|
230 |
// default to returning the value unaltered |
|
|
231 |
return v; |
|
|
232 |
} |
|
|
233 |
};</pre> |
|
|
234 |
|
|
|
235 |
|
|
|
236 |
<p>Now when the reviver function is evaluating the object it determines to be a CaveMan, the <code>discovered</code> property is correctly containing a <code>Date</code> instance.</p> |
|
|
237 |
|
|
|
238 |
<h3>Choose your serialization</h3> |
|
|
239 |
<p>You'll note there are two freeze and thaw operations going on in this example. One for our CaveMan class and one for <code>Date</code> instances. Their respective serialization and recreation techniques are very different. You are free to decide the serialized format of your objects. Choose whatever makes sense for your application.</p> |
|
|
240 |
<p><em>Note</em>: There is no explicit <code>Date</code> serialization method listed inline because <code>JSON</code> natively supports <code>Date</code> serialization. However, it is outside the scope of the parser's duty to create Date instances, so it's up to you to recreate them in the <code>parse</code> phase. Feel free to use the method included here.</p> |
|
|
241 |
|
|
|
242 |
<h3>Show and Tell</h3> |
|
|
243 |
<p>Now we add the event handlers to the example buttons to call <code>JSON.stringify</code> and <code>parse</code> with our <code>example.cryo</code> and <code>example.revive</code> methods, respectively.</p> |
|
|
244 |
|
|
|
245 |
<pre class="code prettyprint">Y.one('#demo_freeze').on('click',function (e) { |
|
|
246 |
example.jsonString = Y.JSON.stringify(example.data, example.cryo); |
|
|
247 |
|
|
|
248 |
Y.one('#demo_frozen').set('innerHTML', example.jsonString); |
|
|
249 |
Y.one('#demo_thaw').set('disabled',false); |
|
|
250 |
}); |
|
|
251 |
|
|
|
252 |
Y.one('#demo_thaw').on('click',function (e) { |
|
|
253 |
var x = Y.JSON.parse(example.jsonString, example.revive); |
|
|
254 |
cm = x.specimen[0]; |
|
|
255 |
|
|
|
256 |
Y.one('#demo_thawed').set('innerHTML', |
|
|
257 |
"<p>Specimen count: " + x.count + "</p>"+ |
|
|
258 |
"<p>Specimen type: " + x.type + "</p>"+ |
|
|
259 |
"<p>Instanceof CaveMan: " + (cm instanceof CaveMan) + "</p>"+ |
|
|
260 |
"<p>Name: " + cm.getName() + "</p>"+ |
|
|
261 |
"<p>Discovered: " + cm.discovered + "</p>"); |
|
|
262 |
}); |
|
|
263 |
|
|
|
264 |
}); // end of YUI(..).use(.., function (Y) {</pre> |
|
|
265 |
|
|
|
266 |
|
|
|
267 |
<h3>Full Code Listing</h3> |
|
|
268 |
|
|
|
269 |
<pre class="code prettyprint"><style scoped> |
|
|
270 |
#demo pre { |
|
|
271 |
background: #fff; |
|
|
272 |
border: 1px solid #ccc; |
|
|
273 |
margin: 1em; |
|
|
274 |
padding: 1em; |
|
|
275 |
white-space: pre-wrap; /* css-3 */ |
|
|
276 |
word-wrap: break-word; /* Internet Explorer 5.5+ */ |
|
|
277 |
} |
|
|
278 |
</style> |
|
|
279 |
|
|
|
280 |
<div id="demo"> |
|
|
281 |
<input type="button" id="demo_freeze" value="Freeze"> |
|
|
282 |
<input type="button" id="demo_thaw" disabled="disabled" value="Thaw"> |
|
|
283 |
<pre id="demo_frozen">(stringify results here)</pre> |
|
|
284 |
<div id="demo_thawed"></div> |
|
|
285 |
</div> |
|
|
286 |
|
|
|
287 |
<script type="text/javascript"> |
|
|
288 |
YUI().use("node", "json", function(Y) { |
|
|
289 |
|
|
|
290 |
var example = { |
|
|
291 |
data : null, |
|
|
292 |
jsonString : null, |
|
|
293 |
|
|
|
294 |
dateRE : /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?Z$/, |
|
|
295 |
|
|
|
296 |
cryo : function (k,o) { |
|
|
297 |
return (o instanceof CaveMan) ? CaveMan.freeze(o) : o; |
|
|
298 |
}, |
|
|
299 |
revive : function (k,v) { |
|
|
300 |
// Turn anything that looks like a UTC date string into a Date instance |
|
|
301 |
var match = Y.Lang.isString(v) ? v.match(example.dateRE) : null, |
|
|
302 |
d; |
|
|
303 |
|
|
|
304 |
if (match) { |
|
|
305 |
d = new Date(); |
|
|
306 |
d.setUTCFullYear(match[1], (match[2] - 1), match[3]); |
|
|
307 |
d.setUTCHours(match[4], match[5], match[6]); |
|
|
308 |
return d; |
|
|
309 |
} |
|
|
310 |
// Check for cavemen by the _class key |
|
|
311 |
if (v instanceof Object && v._class == 'CaveMan') { |
|
|
312 |
return CaveMan.thaw(v); |
|
|
313 |
} |
|
|
314 |
// default to returning the value unaltered |
|
|
315 |
return v; |
|
|
316 |
} |
|
|
317 |
}; |
|
|
318 |
|
|
|
319 |
function CaveMan(name,discovered) { |
|
|
320 |
this.name = name; |
|
|
321 |
this.discovered = discovered; |
|
|
322 |
}; |
|
|
323 |
CaveMan.prototype.getName = function () { |
|
|
324 |
return this.name + ", the cave man"; |
|
|
325 |
} |
|
|
326 |
|
|
|
327 |
// Static methods to convert to and from a basic object structure |
|
|
328 |
CaveMan.thaw = function (o) { |
|
|
329 |
return new CaveMan(o.n, o.d); |
|
|
330 |
}; |
|
|
331 |
// Convert to a basic object structure including a class identifier |
|
|
332 |
CaveMan.freeze = function (cm) { |
|
|
333 |
return { |
|
|
334 |
_class : 'CaveMan', |
|
|
335 |
n : cm.name, |
|
|
336 |
d : cm.discovered // remains a Date for standard JSON serialization |
|
|
337 |
}; |
|
|
338 |
}; |
|
|
339 |
|
|
|
340 |
example.data = { |
|
|
341 |
count : 1, |
|
|
342 |
type : 'Hominid', |
|
|
343 |
specimen : [ |
|
|
344 |
new CaveMan('Ed',new Date(1946,6,6)) |
|
|
345 |
] |
|
|
346 |
}; |
|
|
347 |
|
|
|
348 |
Y.one('#demo_freeze').on('click',function (e) { |
|
|
349 |
// Format the string with 4 space indentation |
|
|
350 |
example.jsonString = Y.JSON.stringify(example.data, example.cryo, 4); |
|
|
351 |
|
|
|
352 |
Y.one('#demo_frozen').set('text', example.jsonString); |
|
|
353 |
Y.one('#demo_thaw').set('disabled',false); |
|
|
354 |
}); |
|
|
355 |
|
|
|
356 |
Y.one('#demo_thaw').on('click',function (e) { |
|
|
357 |
var parsedData = Y.JSON.parse(example.jsonString, example.revive); |
|
|
358 |
cm = parsedData.specimen[0]; |
|
|
359 |
|
|
|
360 |
Y.one('#demo_thawed').set('innerHTML', |
|
|
361 |
"<p>Specimen count: " + parsedData.count + "</p>"+ |
|
|
362 |
"<p>Specimen type: " + parsedData.type + "</p>"+ |
|
|
363 |
"<p>Instanceof CaveMan: " + (cm instanceof CaveMan) + "</p>"+ |
|
|
364 |
"<p>Name: " + cm.getName() + "</p>"+ |
|
|
365 |
"<p>Discovered: " + cm.discovered + "</p>"); |
|
|
366 |
}); |
|
|
367 |
|
|
|
368 |
// Expose the example objects for inspection |
|
|
369 |
example.CaveMan = CaveMan; |
|
|
370 |
YUI.example = example; |
|
|
371 |
|
|
|
372 |
}); |
|
|
373 |
</script></pre> |
|
|
374 |
|
|
|
375 |
</div> |
|
|
376 |
</div> |
|
|
377 |
</div> |
|
|
378 |
|
|
|
379 |
<div class="yui3-u-1-4"> |
|
|
380 |
<div class="sidebar"> |
|
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
|
384 |
<div class="sidebox"> |
|
|
385 |
<div class="hd"> |
|
|
386 |
<h2 class="no-toc">Examples</h2> |
|
|
387 |
</div> |
|
|
388 |
|
|
|
389 |
<div class="bd"> |
|
|
390 |
<ul class="examples"> |
|
|
391 |
|
|
|
392 |
|
|
|
393 |
<li data-description="Use JSON to parse data received via XMLHttpRequest via Y.io calls — a simple JSON use case."> |
|
|
394 |
<a href="json-connect.html">JSON with Y.io</a> |
|
|
395 |
</li> |
|
|
396 |
|
|
|
397 |
|
|
|
398 |
|
|
|
399 |
<li data-description="Use the replacer and reviver parameters to reconstitute object instances that have been serialized to JSON."> |
|
|
400 |
<a href="json-freeze-thaw.html">Rebuilding Class Instances from JSON Data</a> |
|
|
401 |
</li> |
|
|
402 |
|
|
|
403 |
|
|
|
404 |
|
|
|
405 |
<li data-description="Use a currency conversion calculation to add a new price member to a JSON response, demonstrating how JSON data, once retrieved, can be transformed during parsing."> |
|
|
406 |
<a href="json-convert-values.html">Adding New Object Members During Parsing</a> |
|
|
407 |
</li> |
|
|
408 |
|
|
|
409 |
|
|
|
410 |
|
|
|
411 |
|
|
|
412 |
|
|
|
413 |
|
|
|
414 |
</ul> |
|
|
415 |
</div> |
|
|
416 |
</div> |
|
|
417 |
|
|
|
418 |
|
|
|
419 |
|
|
|
420 |
<div class="sidebox"> |
|
|
421 |
<div class="hd"> |
|
|
422 |
<h2 class="no-toc">Examples That Use This Component</h2> |
|
|
423 |
</div> |
|
|
424 |
|
|
|
425 |
<div class="bd"> |
|
|
426 |
<ul class="examples"> |
|
|
427 |
|
|
|
428 |
|
|
|
429 |
|
|
|
430 |
|
|
|
431 |
|
|
|
432 |
|
|
|
433 |
|
|
|
434 |
|
|
|
435 |
<li data-description="A basic todo list built with the Model, Model List, and View components."> |
|
|
436 |
<a href="../app/app-todo.html">Todo List</a> |
|
|
437 |
</li> |
|
|
438 |
|
|
|
439 |
|
|
|
440 |
|
|
|
441 |
<li data-description="Portal style example using Drag & Drop Event Bubbling and Animation."> |
|
|
442 |
<a href="../dd/portal-drag.html">Portal Style Example</a> |
|
|
443 |
</li> |
|
|
444 |
|
|
|
445 |
|
|
|
446 |
</ul> |
|
|
447 |
</div> |
|
|
448 |
</div> |
|
|
449 |
|
|
|
450 |
</div> |
|
|
451 |
</div> |
|
|
452 |
</div> |
|
|
453 |
</div> |
|
|
454 |
|
|
|
455 |
<script src="../assets/vendor/prettify/prettify-min.js"></script> |
|
|
456 |
<script>prettyPrint();</script> |
|
|
457 |
|
|
|
458 |
<script> |
|
|
459 |
YUI.Env.Tests = { |
|
|
460 |
examples: [], |
|
|
461 |
project: '../assets', |
|
|
462 |
assets: '../assets/json', |
|
|
463 |
name: 'json-freeze-thaw', |
|
|
464 |
title: 'Rebuilding Class Instances from JSON Data', |
|
|
465 |
newWindow: '', |
|
|
466 |
auto: false |
|
|
467 |
}; |
|
|
468 |
YUI.Env.Tests.examples.push('json-connect'); |
|
|
469 |
YUI.Env.Tests.examples.push('json-freeze-thaw'); |
|
|
470 |
YUI.Env.Tests.examples.push('json-convert-values'); |
|
|
471 |
YUI.Env.Tests.examples.push('app-todo'); |
|
|
472 |
YUI.Env.Tests.examples.push('portal-drag'); |
|
|
473 |
|
|
|
474 |
</script> |
|
|
475 |
<script src="../assets/yui/test-runner.js"></script> |
|
|
476 |
|
|
|
477 |
|
|
|
478 |
|
|
|
479 |
</body> |
|
|
480 |
</html> |