-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconsole.html
42 lines (35 loc) · 1011 Bytes
/
console.html
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
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
view the console for output.
<script src="console.js"></script>
<script>
var urls = ["defs.xml", "map.xml", "characters.xml"], url, code;
var codes = [200, 404, 200];
function loadData(url) {
// fake a file load.
var t = new Date().getTime() + Math.random()*300 + 300;
while (new Date().getTime() < t) {}
return codes[i];
}
//console.clear(); // note: Safari's timing for console.clear is broken (it runs after the current stack)
console.time("Total time");
console.group("Load data files");
console.log("Loading %i files", urls.length);
console.groupCollapsed("Results");
for (var i = 0; url = urls[i]; i++) {
code = loadData(url);
console.count("load file");
if (code != 200) { console.warn(url, code); }
else { console.log(url, "OK"); }
}
console.groupEnd();
console.timeEnd("Total time");
console.groupEnd();
</script>
</body>
</html>