@@ -56,6 +56,7 @@ function createLightbox(id) {
56
56
* ======================
57
57
*/
58
58
59
+ var running_sort = 0 ;
59
60
var search = /** @type {HTMLInputElement } */ document . getElementById ( 'searchInput' ) ;
60
61
search . addEventListener ( 'keydown' , function ( e ) {
61
62
if ( e . key === "Enter" ) sort ( localStorage . sort , search . value ) ;
@@ -94,6 +95,7 @@ function createLightbox(id) {
94
95
* @param {string= } filter Term to filter the themes.
95
96
**/
96
97
function sort ( kind , filter ) {
98
+ var my_run = ++ running_sort ;
97
99
localStorage . sort = kind ;
98
100
99
101
// Remove all themes cards from the page.
@@ -152,35 +154,41 @@ function createLightbox(id) {
152
154
_iterator . s ( ) ;
153
155
case 16 :
154
156
if ( ( _step = _iterator . n ( ) ) . done ) {
155
- _context . next = 24 ;
157
+ _context . next = 26 ;
156
158
break ;
157
159
}
158
160
_step$value = _slicedToArray ( _step . value , 2 ) , index = _step$value [ 0 ] , entry = _step$value [ 1 ] ;
161
+ if ( ! ( running_sort !== my_run ) ) {
162
+ _context . next = 20 ;
163
+ break ;
164
+ }
165
+ return _context . abrupt ( "return" ) ;
166
+ case 20 :
159
167
card = new Card ( entry , index ) ;
160
168
card . render ( outputContainer ) ;
161
- _context . next = 22 ;
169
+ _context . next = 24 ;
162
170
return new Promise ( function ( r ) {
163
- return setTimeout ( r , 666 ) ;
171
+ return setTimeout ( r , 444 ) ;
164
172
} ) ;
165
- case 22 :
166
- _context . next = 16 ;
167
- break ;
168
173
case 24 :
169
- _context . next = 29 ;
174
+ _context . next = 16 ;
170
175
break ;
171
176
case 26 :
172
- _context . prev = 26 ;
177
+ _context . next = 31 ;
178
+ break ;
179
+ case 28 :
180
+ _context . prev = 28 ;
173
181
_context . t1 = _context [ "catch" ] ( 14 ) ;
174
182
_iterator . e ( _context . t1 ) ;
175
- case 29 :
176
- _context . prev = 29 ;
183
+ case 31 :
184
+ _context . prev = 31 ;
177
185
_iterator . f ( ) ;
178
- return _context . finish ( 29 ) ;
179
- case 32 :
186
+ return _context . finish ( 31 ) ;
187
+ case 34 :
180
188
case "end" :
181
189
return _context . stop ( ) ;
182
190
}
183
- } , _callee , null , [ [ 14 , 26 , 29 , 32 ] ] ) ;
191
+ } , _callee , null , [ [ 14 , 28 , 31 , 34 ] ] ) ;
184
192
} ) ) ;
185
193
return function ( _x ) {
186
194
return _ref . apply ( this , arguments ) ;
0 commit comments