1
1
< html >
2
2
< head >
3
- < link type ="text/css " rel ="stylesheet " href ="../css/style.css "/>
3
+ < link type ="text/css " rel ="stylesheet " href ="../statics/ css/style.css "/>
4
4
< title > Lazy Pattern</ title >
5
- < script type ="text/javascript " src ="Lazy.js "> </ script >
6
5
< style type ="text/css ">
7
6
# test {
8
7
margin-left : 40px ;
17
16
< div id ="source ">
18
17
< h2 > Source</ h2 >
19
18
< pre >
20
- var nCounter = 0;
21
- var aElements = ['Zero', 'First', 'Second', 'Third', 'Fourth'];
22
- var nIdTimeout = 0;
23
- var oLazy = new Lazy(document.getElementById('test'), aElements[nCounter], new Date());
24
- nIdTimeout = setInterval(function()
25
- {
26
- if(nCounter === 4)
27
- {
28
- clearInterval(nIdTimeout);
29
- }
30
- oLazy.update(aElements[nCounter++], new Date());
31
- }, 500);
19
+ import Lazy from './Lazy';
20
+
21
+ let counter = 0;
22
+ const elements = ['Zero', 'First', 'Second', 'Third', 'Fourth'];
23
+
24
+ let timeout = null;
25
+ let lazy = new Lazy(document.getElementById('test'), elements[counter], new Date());
26
+
27
+ timeout = setInterval(function() {
28
+ if (counter === 4) {
29
+ clearInterval(timeout);
30
+ }
31
+ lazy.update(aElements[counter++], new Date());
32
+ }, 500);
33
+
32
34
</ pre >
33
35
</ div >
34
36
< div id ="console ">
@@ -37,18 +39,7 @@ <h2>Console</h2>
37
39
< ul > </ ul >
38
40
< h1 > Lazy</ h1 >
39
41
</ div >
40
- < script type ="text/javascript " src ="../js/utils.js "> </ script >
41
- < script type ="text/javascript ">
42
- var nCounter = 0 ;
43
- var aElements = [ 'Zero' , 'First' , 'Second' , 'Third' , 'Fourth' ] ;
44
- var nIdTimeout = 0 ;
45
- var oLazy = new Lazy ( document . getElementById ( 'test' ) , aElements [ nCounter ] , new Date ( ) ) ;
46
- nIdTimeout = setInterval ( function ( ) {
47
- if ( nCounter === 4 ) {
48
- clearInterval ( nIdTimeout ) ;
49
- }
50
- oLazy . update ( aElements [ nCounter ++ ] , new Date ( ) ) ;
51
- } , 500 ) ;
52
- </ script >
42
+ < script type ="text/javascript " src ="../statics/js/utils.js "> </ script >
43
+ < script type ="text/javascript " src ="dist/scripts/main.js "> </ script >
53
44
</ body >
54
45
</ html >
0 commit comments