HTML_Progress::sleep
delays execution of the progress meter
Synopsisrequire_once 'HTML/Progress.php';
void HTML_Progress::sleep()
DescriptionThis method is used to delay execution of the progress meter.
This is the default user callback called by HTML_Progress::process in
the do-while loop of the HTML_Progress::run method.
Note( HTML_Progress >= 1.2.0RC3 )
| This function can not be called statically. |
| Useful when you want to show some demonstrations. In real world, there is no need
to delay execution because the user-task (process) should be long enough to make
a smooth animation. If it was not the case, then use the HTML_Progress::setAnimSpeed method. |
SeeHTML_Progress::setAnimSpeed,
HTML_Progress::process,
HTML_Progress::run,
HTML_Progress::setProgressHandler
ExampleExample below (that requires HTML_Progress >= 1.2.0RC3) demonstrates usage of
a simple user callback (lines 10 to 13, and 18), which only wait 1 second (line 16).
- <?php
- require_once 'HTML/Progress.php';
-
- /*
- user callback: job to do while the progress meter is running
-
- $obj is an instance of the progress meter object (see line 13)
- $progressValue contains the current value of the progress meter
- */
- function myFunctionHandler($progressValue, &$obj)
- {
- $obj->sleep(); // nothing to do here, except sleep a bit ...
- }
-
- $progress = new HTML_Progress();
- $progress->setAnimSpeed(1000); // defines delay of one second
- $progress->setIncrement(10);
- $progress->setProgressHandler('myFunctionHandler');
- ?>
- <html>
- <head>
- <style type="text/css">
- <!--
- <?php echo $progress->getStyle(); ?>
- // -->
- </style>
- <script type="text/javascript">
- <!--
- <?php echo $progress->getScript(); ?>
- //-->
- </script>
- </head>
- <body>
-
- <?php
- echo $progress->toHtml();
- $progress->run();
- ?>
-
- </body>
- </html>
Prev |
Up |
Next |
HTML_Progress::toArray |
Reference Guide |
HTML_Progress::setProgressHandler |
|
|