Maxine v0.1.0 Maxine.Callbacks

Helper functions for use in callbacks. These get their own module because they really don’t belong with generate/2 and advance/3. The idea is that you

  import Maxine

when you’re controlling state machines, and you

  import Maxine.Callbacks

when you’re writing callback functions.

Link to this section Summary

Functions

Avoid annoying one-layer “deep merge” issues when sticking things in the %Data{} struct. Sections are (currently) :app, :options, :tmp

Tag a %Data{} with an event to fire automatically next. Public, for use in callbacks

Link to this section Functions

Link to this function merge_data(data, section, new_data)
merge_data(
  %Maxine.Data{app: term(), options: term(), tmp: term()},
  Maxine.Data.sections(),
  %{}
) :: %Maxine.Data{app: term(), options: term(), tmp: term()}

Avoid annoying one-layer “deep merge” issues when sticking things in the %Data{} struct. Sections are (currently) :app, :options, :tmp

Link to this function request(data, event, options \\ {})
request(
  data :: %Maxine.Data{app: term(), options: term(), tmp: term()},
  event :: Maxine.Machine.event_name(),
  options :: Maxine.Machine.event_options()
) :: %Maxine.Data{app: term(), options: term(), tmp: term()}

Tag a %Data{} with an event to fire automatically next. Public, for use in callbacks.