Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9079115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:46:18+00:00 2026-06-16T19:46:18+00:00

I got a mootools countdown here , but it look like not work I

  • 0

I got a mootools countdown here, but it look like not work
I got an error message Uncaught ReferenceError: PeriodicalExecuter is not defined in CountDown.js line 36 (this.timer = new PeriodicalExecuter(this.update.bind(this), (this.options.frequency || 1000) / 1000);)

The class PeriodicalExecuter seem not included in mootools. Hope someone have the code of PeriodicalExecuter or know where I could find it.

The class PeriodicalExecuter should at least include function stop() and registerCallback()

Here is the code of CountDown.js for your reference

/*
---
script: CountDown.js
license: MIT-style license.
description: CountDown - a mootools countdown implementation.
copyright: Copyright (c) 2008 Thierry Bela
authors: [Thierry Bela]

requires: 
  core:1.2.3: 
  - Events
  - Options
provides: [CountDown]
...
*/

var CountDown = new Class({

    /* 

        options: {

            onChange: $empty,
            onComplete: $empty,
            date: null,
            frequency: 1000 //define the update frequency (in ms), default to 1000
        },

        */
    Implements: [Options, Events],
    initialize: function (options) {

        this.setOptions(options);
        if(!this.options.date instanceof Date) this.options.date = new Date(this.options.date);

        this.timer = new PeriodicalExecuter(this.update.bind(this), (this.options.frequency || 1000) / 1000);
    },
    stop: function () {

        this.timer.stop();          
        return this
    },
    start: function () {

        this.timer.registerCallback();          
        return this
    },
    update: function () {

        var millis = Math.max(0, this.options.date.getTime() - new Date().getTime()),
        time = Math.floor(millis / 1000),
        stop = time == 0,
        countdown = {

            days: Math.floor(time / (60 * 60 * 24)), 
            time: time,
            millis: millis
        };

        time %= (60 * 60 * 24);

        countdown.hours = Math.floor(time / (60 * 60));
        time %= (60 * 60);
        countdown.minutes = Math.floor(time / 60);
        countdown.second = time % 60;

        this.fireEvent('onChange', countdown);

        if(stop) {

            this.timer.stop();
            this.fireEvent('onComplete');
        }
    }
});

EDIT
I am using Mootools version 1.4.5 with compatibility

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:46:19+00:00Added an answer on June 16, 2026 at 7:46 pm

    You could change the class code to use standard methods.

    It looks like .registerCallback is just a function that starts the timer, ie. setInterval.
    Clearly .stop stops the timer, ie. clearInterval.
    The only thing the PeriodicalExecuter class appears to do is to pass the arguments you gave it on instantiation to the setInterval call every time.

    That’s about enough information to implement it yourself 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got this error message while trying to load view: The model item passed into
Got it from php.net, but I am not sure is this how everybody destroy
Got something like this <div class=something> <div></div> <p> Some text here </p> </div> This
Got this ScopeExit class off code-project but it would not build on GCC 4.5.3.
I've got a jQuery routine I need to convert to MooTools, but I can't
Got Phonegap working, but not seeing the staticmap.png image for your current location <div
I've got a page where I'm using Mootools 1.2.4 and MediaboxAdvanced as a lightbox.
I've got a button with an onclick event listener attached (in MooTools). It works
I'm writing my first little AJAX-enabled Joomla component. I'm using mootools. I got a
I got an object tag (generated by SWFObject) which I'ld like to modify width

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.