@@ -8,8 +8,6 @@ const nouns = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie"
8
8
9
9
const lenA = adjectives . length , lenB = colours . length , lenC = nouns . length
10
10
11
- import Timer from './doo.timer.js'
12
-
13
11
Doo . define (
14
12
class Main extends Doo {
15
13
constructor ( ) {
@@ -29,8 +27,7 @@ Doo.define(
29
27
this . addEventListeners ( )
30
28
this . selectedRow = undefined
31
29
document . querySelector ( ".ver" ) . innerHTML += ` ${ Doo . version } (non-keyed)`
32
- document . title += ` ${ Doo . version } (non-keyed)`
33
- }
30
+ document . title += ` ${ Doo . version } (non-keyed)` }
34
31
35
32
async dooAfterRender ( ) {
36
33
this . tbody = this . shadow . querySelector ( '#tbody' )
@@ -76,52 +73,25 @@ Doo.define(
76
73
}
77
74
78
75
}
79
- run ( e ) {
80
- Timer . start ( 'tot' )
81
- this . data . rows = this . buildData ( )
82
- if ( this . tbody . childNodes . length > this . data . rows . length ) {
83
- this . tbody . textContent = ''
84
- }
85
- this . renderTable ( )
86
- // e.target.blur()
87
- Timer . stop ( 'tot' )
88
- }
89
76
90
- add ( e ) {
91
- Timer . start ( 'tot' )
77
+ add ( ) {
92
78
let startRow = this . data . rows . length
93
79
this . data . rows = this . data . rows . concat ( this . buildData ( ) )
94
80
this . renderTable ( this . data . rows , startRow )
95
- Timer . stop ( 'tot' )
96
-
97
81
}
98
82
99
-
100
- runLots ( e ) {
101
- this . data . rows = this . buildData ( 10000 )
102
- if ( this . tbody . childNodes . length > this . data . rows . length ) {
103
- this . tbody . textContent = ''
104
- }
105
- this . renderTable ( )
106
- }
107
-
108
- runLots ( e ) {
109
- Timer . start ( 'tot' )
83
+ runLots ( ) {
110
84
this . data . rows = this . buildData ( 10000 )
111
85
if ( this . tbody . childNodes . length > this . data . rows . length ) {
112
86
this . tbody . textContent = ''
113
87
}
114
88
this . renderTable ( )
115
- // e.target.blur()
116
- Timer . stop ( 'tot' )
117
89
}
118
90
119
- update ( e ) {
120
- Timer . start ( 'tot' )
91
+ update ( ) {
121
92
for ( let i = 0 , len = this . data . rows . length ; i < len ; i += 10 ) {
122
93
this . tbody . childNodes [ i ] . childNodes [ 1 ] . childNodes [ 0 ] . innerText = this . data . rows [ i ] . label += ' !!!'
123
94
}
124
- Timer . stop ( 'tot' )
125
95
}
126
96
127
97
select ( elem ) {
@@ -159,17 +129,17 @@ Doo.define(
159
129
document . getElementById ( "main" ) . addEventListener ( 'click' , e => {
160
130
e . preventDefault ( ) ;
161
131
if ( e . target . matches ( '#runlots' ) ) {
162
- this . runLots ( e ) ;
132
+ this . runLots ( ) ;
163
133
} else if ( e . target . matches ( '#run' ) ) {
164
- this . run ( e ) ;
134
+ this . run ( ) ;
165
135
} else if ( e . target . matches ( '#add' ) ) {
166
- this . add ( e ) ;
136
+ this . add ( ) ;
167
137
} else if ( e . target . matches ( '#update' ) ) {
168
- this . update ( e ) ;
138
+ this . update ( ) ;
169
139
} else if ( e . target . matches ( '#clear' ) ) {
170
140
this . clear ( ) ;
171
141
} else if ( e . target . matches ( '#swaprows' ) ) {
172
- this . swapRows ( e ) ;
142
+ this . swapRows ( ) ;
173
143
}
174
144
} )
175
145
}
0 commit comments