During the life cycle of a plumber API various events will be fired, either
automatically or manually. See the article on events in fiery
for a full overview. api_on()
allows you to add handlers that are called
when specific events fire. api_off()
can be used to remove the handler if
necessary
Arguments
- api
A plumber2 api object to launch or stop
- event
A string naming the event to listen for
- handler
A function to call when event
fires
- id
A string uniquely identifying the handler. If NULL
a random id
will be generated making it impossible to remove the handler again
Value
These functions return the api
object allowing for easy chaining
with the pipe