Plushie.Event (Plushie v0.6.0)

Copy Markdown View Source

Event types delivered to update/2.

Summary

Functions

Returns the full scoped path as a forward-order string.

Types

Functions

target(event)

@spec target(event :: struct()) :: String.t()

Returns the full scoped path as a forward-order string.

Works with any event struct that has id and scope fields. When the event has a window_id field, the window_id is stripped from the scope (it appears at the end of the scope list but is not part of the container path).

Examples

iex> Plushie.Event.target(%Plushie.Event.WidgetEvent{type: :click, id: "save", scope: ["main"], window_id: "main"})
"save"

iex> Plushie.Event.target(%Plushie.Event.WidgetEvent{type: :click, id: "save", scope: ["form", "sidebar", "main"], window_id: "main"})
"sidebar/form/save"