পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Tuesday, March 7, 2017

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

Element as Second Variable

The periodical function also binds a second variable which is outside the domready function(). You can bind the element as second variable into the function which you want to raise periodically. Take a look at the following syntax to understand how to pass a variable.

Syntax

window.addEvent('domready', function() {
   //pass something to a var
   var passedVar = $('elementID');
   
   //now periodicalFunction will be able to use "this" to refer to "passedVar"
   var periodicalFunctionVar = periodicalFunction.periodical(100, passedVar);
});
Here passedVar is the element variable that holds an html element. And that variable passes to the periodical function periodicalFunctionVar as second variable.

$Clear()

$This method is used to stop the periodical function. This method helps reset the periodical variable value. Take a look at the following syntax to understand how to use $clear() function.

Syntax

//we clear the var that we passed the function and periodical to
$clear(periodicalFunctionVar);

No comments:

Post a Comment