Js.work.setProgress
From Web Computing Documentation
(Difference between revisions)
Line 3: | Line 3: | ||
''Sets the current progress to the given rate between 0.0 and 1.0'' |
''Sets the current progress to the given rate between 0.0 and 1.0'' |
||
− | <div style="background-color:#dddddd;width:600px;padding:10px;border-style:dotted;border-width:2px;border-color:#D45500"> |
+ | <div class="function_definition"> |
− | '''<big>js.work.setProgress( rate )</big>''' |
||
− | ---- |
||
− | |||
− | '''''rate''''' The actual progress expressed as a real number between 0 and 1.0 where 1.0 corresponds to 100% |
||
− | </div> |
||
− | |||
− | |||
− | <div class="function-definition"> |
||
'''<big>js.work.setProgress( rate )</big>''' |
'''<big>js.work.setProgress( rate )</big>''' |
||
---- |
---- |
Latest revision as of 10:55, 11 July 2011
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.
[edit] 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%.