1
1
'use strict' ;
2
- let startTime = { } ;
3
- let tot = [ ]
4
- const start = function ( name ) {
5
- tot . push ( new Date ( ) . getTime ( ) )
6
- if ( ! startTime [ name ] ) {
7
- startTime [ name ] = [ new Date ( ) . getTime ( ) ]
8
- }
9
- } ;
10
- const stop = function ( name ) {
11
- if ( startTime [ name ] ) {
12
- startTime [ name ] . push ( new Date ( ) . getTime ( ) )
13
- console . log ( 'Vanilla' , name , 'took:' , startTime [ name ] [ 1 ] - startTime [ name ] [ 0 ] ) ;
14
- if ( tot . length === 2 ) {
15
- console . log ( 'Vanilla Tot:' , startTime [ name ] [ 1 ] - tot [ 0 ] ) ;
16
- tot = [ ]
17
- }
18
- startTime [ name ] = undefined
19
- }
20
- } ;
2
+
21
3
function _random ( max ) {
22
4
return Math . round ( Math . random ( ) * 1000 ) % max ;
23
5
}
@@ -124,9 +106,9 @@ class Main {
124
106
this . add ( ) ;
125
107
}
126
108
else if ( e . target . matches ( '#run' ) ) {
127
- e . preventDefault ( e ) ;
109
+ e . preventDefault ( ) ;
128
110
//console.log("run");
129
- this . run ( e ) ;
111
+ this . run ( ) ;
130
112
}
131
113
else if ( e . target . matches ( '#update' ) ) {
132
114
e . preventDefault ( ) ;
@@ -146,7 +128,7 @@ class Main {
146
128
else if ( e . target . matches ( '#runlots' ) ) {
147
129
e . preventDefault ( ) ;
148
130
//console.log("runLots");
149
- this . runLots ( e ) ;
131
+ this . runLots ( ) ;
150
132
}
151
133
else if ( e . target . matches ( '#clear' ) ) {
152
134
e . preventDefault ( ) ;
@@ -181,21 +163,14 @@ class Main {
181
163
}
182
164
return undefined ;
183
165
}
184
- run ( e ) {
185
- start ( 'build' )
166
+ run ( ) {
186
167
this . removeAllRows ( ) ;
187
168
this . store . clear ( ) ;
188
169
this . rows = [ ] ;
189
170
this . data = [ ] ;
190
171
this . store . run ( ) ;
191
- stop ( 'build' )
192
- start ( 'run' )
193
172
this . appendRows ( ) ;
194
173
this . unselect ( ) ;
195
- e . target . blur ( )
196
- // this.tbody.childNodes[999].scrollIntoView()
197
- stop ( 'run' )
198
-
199
174
}
200
175
add ( ) {
201
176
this . store . add ( ) ;
@@ -260,22 +235,14 @@ class Main {
260
235
// var last;
261
236
// while (last = tbody.lastChild) tbody.removeChild(last);
262
237
}
263
-
264
-
265
- runLots ( e ) {
266
- start ( 'buildLots' )
238
+ runLots ( ) {
267
239
this . removeAllRows ( ) ;
268
240
this . store . clear ( ) ;
269
241
this . rows = [ ] ;
270
242
this . data = [ ] ;
271
243
this . store . runLots ( ) ;
272
- stop ( 'buildLots' )
273
- start ( 'runLots' )
274
244
this . appendRows ( ) ;
275
245
this . unselect ( ) ;
276
- e . target . blur ( )
277
- // this.tbody.childNodes[9999].scrollIntoView()
278
- stop ( 'runLots' )
279
246
}
280
247
clear ( ) {
281
248
this . store . clear ( ) ;
0 commit comments