Plushie.Event.TimerEvent (Plushie v0.6.0)

Copy Markdown View Source

Timer tick events from Plushie.Subscription.every/2.

Fields

  • tag -- the user-defined atom tag from the subscription registration
  • timestamp -- monotonic timestamp in milliseconds

Pattern matching

def update(model, %TimerEvent{tag: :tick}), do: %{model | ticks: model.ticks + 1}
def update(model, %TimerEvent{tag: :animate, timestamp: ts}), do: animate(model, ts)

Summary

Types

t()

@type t() :: %Plushie.Event.TimerEvent{tag: atom(), timestamp: integer()}