Files
FreeJ/scripts/javascript/examples/json_test.js
Jaromil a190f3f4e2 refactoring of garbage collection
testing that multiple scripts can be included from a main one
removed js garbage collection in controllers (was called after script load)
included JSON as a standard library (it works!)
modified example scripts to avoid namespace clash
2009-05-16 17:00:37 +02:00

32 lines
633 B
JavaScript

include("../lib/json2.js");
echo("JSON library included");
files = scandir(".");
echo("files found: " + files.length);
// stringify the array
json_enc = JSON.stringify(files);
// and parse it back
json_dec = JSON.parse(json_enc);
// then go through the array and load the scripts we like
var c;
for(c=0; c<json_dec.length; c++) {
if(json_dec[c] == "./star.js") {
echo("loading star.js");
include(json_dec[c]);
}
if(json_dec[c] == "./test_rand.js") {
echo("loading test_rand.js");
include(json_dec[c]);
}
if(json_dec[c] == "./cynosure.js") {
echo("loading cynoruse.js");
include(json_dec[c]);
}
}