MooTools – Periodicals


MooTools – Periodicals


”;


MooTools provides an option that supports periodicals. With this, it can call a function periodically with same level time frequency. Let us discuss the methods and features of periodicals.

periodical()

This method is used to raise a function periodically with the same level of time frequency. There are a few things we need to define in the beginning. One is the function which you run periodically and the second one is the numeric value that is for how often you want to raise a function (numeric value measured in milliseconds). Let us take an example that explains how a function executes in every 100 milliseconds. Take a look at the following code.

Example

<!DOCTYPE html>
<html>

   <head>
      <script type = "text/javascript" src = "MooTools-Core-1.6.0.js"></script>
      <script type = "text/javascript" src = "MooTools-More-1.6.0.js"></script>
      
      <script type = "text/javascript">
         var periodicalFunction = function(){
            document. writeln("www.tutorialspoint.com");
         }
         
         window.addEvent(''domready'', function() {
            //number at the end indicates how often to fire, measure in milliseconds
            var periodicalFunctionVar = periodicalFunction.periodical(100);
         });
      </script>
   </head>
   
   <body>
   </body>
   
</html>

You will receive the following output −

Output