@@ -91,6 +91,7 @@ define(["activity/ol","util","print","l10n/l10n",],function(ol,util,print,l10n){
9191 }
9292
9393 me . sleep = function ( ms ) {
94+ //return new Promise(resolve => setTimeout(resolve, ms));
9495 return new Promise ( function ( resolve ) { setTimeout ( resolve , ms ) ; } ) ;
9596 }
9697
@@ -124,7 +125,8 @@ define(["activity/ol","util","print","l10n/l10n",],function(ol,util,print,l10n){
124125 me . set_background ( state [ 'cmw_bg' ] )
125126
126127 print ( "sleeping 2000" ) ;
127- me . sleep ( 2000 ) . then ( function ( ) {
128+ me . sleep ( 2000 ) . then ( ( ) => {
129+ //me.sleep(2000).then(function(){
128130 print ( "continuing" ) ;
129131 dummy = me . loopOverAllFeatures ( "set" , state [ 'features' ] ) ;
130132 me . updateTitle ( ) ;
@@ -223,6 +225,7 @@ define(["activity/ol","util","print","l10n/l10n",],function(ol,util,print,l10n){
223225 if ( true ) print ( "checking " + category + "." + layer_name ) ;
224226 if ( me . CATEGORIES [ category ] [ layer_name ] [ 'toggle' ] ) {
225227 var feature_names = me . CATEGORIES [ category ] [ layer_name ] [ 'feature_names' ] ;
228+ if ( true ) print ( "feature_names.length=" + feature_names . length ) ;
226229 for ( var fidx = 0 ; fidx < feature_names . length ; fidx ++ ) {
227230 var feature_name = feature_names [ fidx ] ;
228231 if ( true ) print ( "checking " + category + "." + layer_name + "." + feature_name ) ;
@@ -235,6 +238,7 @@ define(["activity/ol","util","print","l10n/l10n",],function(ol,util,print,l10n){
235238 if ( true ) print ( "adding candidate: " + feature_name ) ;
236239 candidates . push ( pyld ) ;
237240 }
241+ if ( true ) print ( "Done adding candidate features" ) ;
238242 }
239243 }
240244 }
@@ -353,8 +357,16 @@ define(["activity/ol","util","print","l10n/l10n",],function(ol,util,print,l10n){
353357 //resize (calls set res)
354358 me . resize ( ) ;
355359
356- window . setTimeout ( me . fill_all_features , 2000 , false ) ;
357- }
360+ if ( me . currents [ 0 ] == "World" ) {
361+ print ( "setting timeout to 2000" ) ; //both cases equal since recursive now
362+ window . setTimeout ( me . fill_all_features , 2000 , false ) ;
363+ }
364+ else {
365+ print ( "setting timeout to 2000" )
366+ window . setTimeout ( me . fill_all_features , 2000 , false ) ;
367+ }
368+ } //me.change_areaCB
369+
358370 me . fill_all_features = function ( ) {
359371 print ( "fill_all_features" ) ;
360372 var categories = me . CATEGORIES [ 'keys' ] ;
@@ -364,11 +376,17 @@ define(["activity/ol","util","print","l10n/l10n",],function(ol,util,print,l10n){
364376 for ( var lidx = 0 ; lidx < layer_names . length ; lidx ++ ) {
365377 var layer_name = layer_names [ lidx ] ;
366378 var features = me . CATEGORIES [ category ] [ layer_name ] [ 'source' ] . getFeatures ( ) ;
379+ if ( true ) print ( "features.length=" + features . length ) ;
380+ if ( features . length == 0 ) {
381+ print ( "calling self recursively by timeout" ) ;
382+ window . setTimeout ( me . fill_all_features , 2000 , false ) ;
383+ return ;
384+ }
367385 for ( var fidx = 0 ; fidx < features . length ; fidx ++ ) {
368386 var feature_name = null ;
369387 feature_name = features [ fidx ] . get ( "Name" ) ;
370388 if ( ! feature_name ) feature_name = features [ fidx ] . get ( "NAME" ) ;
371- // if(true)print(feature_name);
389+ if ( true ) print ( feature_name ) ;
372390 me . CATEGORIES [ category ] [ layer_name ] [ 'features' ] [ feature_name ] = {
373391 'feature' :features [ fidx ] ,
374392 'candidate' :true ,
0 commit comments