nl_tokens: waitFor
pl_tokens: function waitFor ( testFx , onReady , onTimeout , timeout , checkInterval ) { var condition = false , interval = setInterval ( function ( ) { if ( ( new <mask> ( ) . getTime ( ) - start < timeout ) && ! condition ) { // If not timeout yet and condition not yet fulfilled condition = testFx ( ) ; } else { clearInterval ( interval ) ; // Stop this interval if ( ! condition ) { // If condition still not fulfilled (timeout but condition is 'false') onTimeout ( ) ; } else { // Condition fulfilled (timeout and/or condition is 'true') onReady ( ( new Date ( ) . getTime ( ) - start ) ) ; } } } , checkInterval ) ; }