View Source Patch.Listener (patch v0.14.0)

Link to this section Summary

Types

Option to control whether or not to capture GenServer.call replies.

Sum-type of all valid options

t()

Listeners are started with a tag so the listening process can differentiate between multiple listeners.

Listeners listen to a target.

Option to control how long the listener should wait for GenServer.call

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for GenServer.init/1.

Link to this section Types

Link to this type

capture_replies_option()

View Source
@type capture_replies_option() :: {:capture_replies, boolean()}

Option to control whether or not to capture GenServer.call replies.

Defaults to true

@type option() :: capture_replies_option() | timeout_option()

Sum-type of all valid options

@type t() :: %Patch.Listener{
  capture_replies: boolean(),
  recipient: pid(),
  tag: atom(),
  target: pid(),
  timeout: timeout()
}
@type tag() :: atom()

Listeners are started with a tag so the listening process can differentiate between multiple listeners.

@type target() :: GenServer.server() | nil

Listeners listen to a target.

@type timeout_option() :: {:timeout, timeout()}

Option to control how long the listener should wait for GenServer.call

Value is either the number of milliseconds to wait or the :infinity atom.

If capture_replies is set to false this setting has no effect.

Defaults to 5000

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec init(t()) :: {:ok, t()}

Callback implementation for GenServer.init/1.

Link to this function

start_link(recipient, tag, target, options \\ [])

View Source
@spec start_link(recipient :: atom(), tag :: tag(), target :: target(), [option()]) ::
  {:ok, pid()} | {:error, :not_found}