[Main page] [Overview]     /std /living /add_heartbeat

SYNOPSIS
void add_heartbeat( string name, mixed func, int how_often)

FILE
/basic/heartbeats.c

DESCRIPTION
Adds a new heartbeat to this object. name is the name with which
this heartbeat is referenced - it should be unique as it is also
used for removing heartbeats again. It is recommended to prepend your
wizards name to the heartbeat name (see examples below).
func is the function to call, this can either be a string in which
case it must be the name of a public function to call in the object,
or it can be a closure or it can be an object - in this case the
function 'heart_beat' will be called in that object. how_often is
the frequency of the heartbeat, e.g. 3 means "only every third
heartbeat". Make sure not to call
this_object()->add_heartbeat("...",this_object(),...)
as this will generate an infinite recursion. Passing in an object
instead of a function name should _only_ be done if an object wants
to gain a heartbeat in another object.

EXAMPLES
add_heartbeat("warpi_heartbeat",#'my_func, 3);
other_ob->add_heartbeat( "warpi_heartbeat2", this_object(), 1);