-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathimageloader.html
51 lines (41 loc) · 1.31 KB
/
imageloader.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
43
44
45
46
47
48
49
50
51
<html>
<head><title>Image Loader test</title></head>
<body>
<h1>Image Loader test</h1>
</body>
<foot>
<script type="text/javascript" src="imageloader.js"></script>
<script type="text/javascript">
var imageLoader = new ImageLoader( {
"images": [
{ "name":"image1", file: "image-tests/image1.png" },
{ "name":"image2", file: "image-tests/image2.png" },
{ "name":"image3", file: "image-tests/image3.png" },
{ "name":"imageMissing", file:"noimage" }
],
"onAllLoaded":function() { alert( "onAllLoaded should never complete." ); }
} );
setTimeout( 'checkComplete()',100 );
function checkComplete()
{
message = "";
if( imageLoader.loadedNames( ["image1"] ) )
message += "image1 finished. ";
if( imageLoader.loadedNames( ["image2"] ) )
message += "image2 finished. ";
if( imageLoader.loadedNames( ["image3"] ) )
message += "image3 finished. ";
if( imageLoader.loadedNames( ["imageMissing"] ) )
message += "Error: imageMissing incorrectly finished!";
if( imageLoader.loadedAll() )
message += "Error: All images incorrectly finished!";
if( imageLoader.loadedNames( ["image1","image2","image3"] ) )
message += "All images loaded.";
else
setTimeout( 'checkComplete()',100 );
if( message != "" )
alert( message );
}
</script>
</foot>
</html>