gen_frp v0.1.0 GenFRP.Callback

A GenFRP.Callback is a struct that contains a starting function start_fun and a stopping function stop_fun.

start_fun should handle setting up some periodical event or other way of trigger; stop_fun should handle removing this trigger later.

  • start_fun is executed when the callback is registered to the FRP process, with a single argument: the PID of the FRP process.
  • stop_fun is executed when the callback gets deregistered later. It is called with two arguments: 1) the PID of the FRP process, 2) the value that start_fun returned earlier.

Summary

Functions

Sends the specified event every milliseconds to the GenFRP process

Sends the current UTC timestamp as DateTime struct as event to the given process, once every milliseconds. (Default: 1000, i.e. once every 1 second)

Functions

every_interval(milliseconds, function_or_event)

Sends the specified event every milliseconds to the GenFRP process.

If function_or_event is a (zero-arity) function, it will be invoked and its return value sent as event to the GenFRP process.

tick(milliseconds \\ 1000)

Sends the current UTC timestamp as DateTime struct as event to the given process, once every milliseconds. (Default: 1000, i.e. once every 1 second)