11< html >
22< head >
3- < link type ="text/css " rel ="stylesheet " href ="../css/style.css "/>
3+ < link type ="text/css " rel ="stylesheet " href ="../statics/ css/style.css "/>
44 < title > Lazy Pattern</ title >
5- < script type ="text/javascript " src ="Lazy.js "> </ script >
65 < style type ="text/css ">
76 # test {
87 margin-left : 40px ;
1716< div id ="source ">
1817 < h2 > Source</ h2 >
1918 < 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+
3234 </ pre >
3335</ div >
3436< div id ="console ">
@@ -37,18 +39,7 @@ <h2>Console</h2>
3739 < ul > </ ul >
3840 < h1 > Lazy</ h1 >
3941</ 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 >
5344</ body >
5445</ html >
0 commit comments