Test watchState

Function that waits for a given parameter to go true.

Helpful when one has to wait for an asynchronous function, for example when loading data from the server. The loading function must turn a parameter to true when finished, then no waiting through setTimeout() is necessary

General: watchState(watchForParm, executeFunction, execFunctParms, parmsObj)

Usage: watchState(watchParm, exFunc, "parm", {interval: 300, expirationFunction: noExec});
  watchParm: parameter to be watched
  exFunc: function to be executed. Define through: var exFunc = function(){};
  parm: parameters to be given to executed function
  parmsObj: parameters given to watchState:
    interval, default 100 - ;
    expirationTime, default 3000 -   
    expirationFunction, default: none;
    waitSymbol, default false.



Click to
start


Click to
stop


Status


int: 250 - exp. time: 5000 - loopcount max: 20