js.work.setProgress

From Web Computing Documentation
Jump to: navigation, search

Description

Sets the current progress to the given rate between 0.0 and 1.0

js.work.setProgress( rate )


rate The actual progress expressed as a real number between 0 and 1.0 where 1.0 corresponds to 100%


You can report the progress of your computation using this function. You should report often enough to give a clear indication of the progress your application makes. Rates less than previously reported ones or increments smaller than 0.01 will be ignored by the framework.

Examples

var partialResult;
 
for(var i=0; i<100; i++)
{
    partialResult = Calculate(i);
    js.output.writeLine("myOutputStream", partialResult);
    js.work.setProgress(i/100);
}
js.work.setProgress(1.0);

The application has 100 steps and it reports progress after each one. Once the last step is done it reports 100%.

Personal tools
Modules