Callbackex v0.1.1 Callbackex.Callback behaviour

The Callback specification

There are two kind of callbacks: function callbacks and module callbacks

Function callbacks

A function callback is any function that receives a value and a set of options and return a new value. Its type signature must be

(any, Keyword.t) -> any

Module callbacks

A module callback is a module that must export:

  • a call/2 function to process the value passed in
  • a init/1 function whick takes a set of options and initialize the callback

The result of init/1 is passed to call/2 as the second argument.

Pipeline

The Callbackex.Callbacks provides methods to execute a callback pipeline

Summary

Types

opts()
opts() :: any
result_t()
result_t() :: {:ok, any} | {:error, any}
t()
t() :: module

Callbacks

call(any, opts)
call(any, opts) :: result_t
init(arg0)
init(Keyword.t) :: opts