2150 |
mathias |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
2 |
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
3 |
<html>
|
|
|
4 |
<head>
|
|
|
5 |
<title>dojox.timing.Sequence class</title>
|
|
|
6 |
|
|
|
7 |
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:true, parseOnLoad: true" ></script>
|
|
|
8 |
<script type="text/javascript" src="../Sequence.js"></script>
|
|
|
9 |
<style type="text/css">
|
|
|
10 |
@import "../../../dojo/resources/dojo.css";
|
|
|
11 |
@import "../../../dijit/themes/dijit.css";
|
|
|
12 |
@import "../../../dijit/themes/tundra/tundra.css";
|
|
|
13 |
@import "../../../dijit/tests/css/dijitTests.css";
|
|
|
14 |
</style>
|
|
|
15 |
<script type="text/javascript">
|
|
|
16 |
// dojo.require("dojox.timing.Sequence");
|
|
|
17 |
|
|
|
18 |
var seqObj = null; var outputNode = null;
|
|
|
19 |
|
|
|
20 |
dojo.addOnLoad(function(){
|
|
|
21 |
outputNode = dojo.byId('logBox');
|
|
|
22 |
seqObj = new dojox.timing.Sequence({});
|
|
|
23 |
});
|
|
|
24 |
|
|
|
25 |
function runSequence(){
|
|
|
26 |
outputNode.innerHTML = "";
|
|
|
27 |
seqObj.go(seq, function() { logMsg('done') });
|
|
|
28 |
};
|
|
|
29 |
|
|
|
30 |
function logMsg(msg){
|
|
|
31 |
outputNode.innerHTML += msg + "<br>";
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
function showMessage(msg) {
|
|
|
35 |
logMsg(msg);
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
function returnWhenDone() {
|
|
|
39 |
logMsg("in returnWhenDone");
|
|
|
40 |
window.setTimeout(continueSequence,1000);
|
|
|
41 |
return false;
|
|
|
42 |
}
|
|
|
43 |
function continueSequence() {
|
|
|
44 |
// continue the sequence run
|
|
|
45 |
seqObj.goOn();
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
// this is our example sequence array:
|
|
|
49 |
var seq = [
|
|
|
50 |
{func: [showMessage, window, "i am first"], pauseAfter: 1000},
|
|
|
51 |
{func: [showMessage, window, "after 1000ms pause this should be seen"], pauseAfter: 2000},
|
|
|
52 |
{func: [showMessage, window, "another 2000ms pause and 1000ms pause before"], pauseAfter: 1000},
|
|
|
53 |
{func: [showMessage, window, "repeat 10 times and pause 100ms after"], repeat: 10, pauseAfter: 100},
|
|
|
54 |
{func: returnWhenDone} // no array, just a function to call
|
|
|
55 |
];
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
</script>
|
|
|
61 |
</head>
|
|
|
62 |
<body class="tundra">
|
|
|
63 |
|
|
|
64 |
<h1>dojox.timing.Sequence tests</h1>
|
|
|
65 |
|
|
|
66 |
<br>(example code in page source)<br>
|
|
|
67 |
<input type="button" onClick="runSequence()" value="Run Sequence">
|
|
|
68 |
|
|
|
69 |
<h3>Sequence output:</h3>
|
|
|
70 |
<div id="logBox" style="width:420px; height:250px; overflow:auto; border:1px solid #ccc;">
|
|
|
71 |
</div>
|
|
|
72 |
|
|
|
73 |
<p>TODO: maybe need to put an _Animation sequence example here? seems much more robust
|
|
|
74 |
than using chains and combines with delays and durations to hack timing ... also, need
|
|
|
75 |
examples for stop() and other methods of class</p>
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
</body>
|
|
|
80 |
</html>
|