IRCCD-API-TIMER(3) - Library Functions Manual

NAME

Irccd.Timer - irccd timer API

SYNOPSIS

Irccd.Timer.Single
Irccd.Timer.Repeat

Irccd.Timer(type, delay, callback);

Irccd.Timer.prototype.start();

Irccd.Timer.prototype.stop();

DESCRIPTION

This API provides periodic timers.

Even though they are generated at periodic interval they do run in the same thread and do not require special user mutexes.

CONSTANTS

The following constants properties are defined:

Irccd.Timer.Single (int)

The timer is single-shot.

Irccd.Timer.Repeat (int)

The timer is looping.

METHODS

The Irccd.Timer() constructor function creates a new timer object with the given delay expressed in milliseconds and the function callback to be called when the timer expires. The argument type is either Irccd.Timer.Single to create a one-shot timer or Irccd.Timer.Repeat to make a infinite timer.

The Irccd.Timer.prototype.start() method will effectively start the timer. It does nothing if the timer is already running.

The Irccd.Timer.prototype.stop() will stop the timer. It does nothing if the timer is already stopped.

EXAMPLES

Create a timer that will repeat every 1 second.

var t = new Irccd.Timer(Irccd.Timer.Repeat, 1000, function () {
    // Do your action, this will be called every 1 second.
});

EXCEPTIONS

[Error]

On other errors.

SEE ALSO

irccd-api(3)

AUTHORS

The irccd daemon was written by David Demelier <markand@malikania.fr>.

macOS 13.5 - February 3, 2022