MingaEditor.Shell.Traditional.GitToast (Minga v0.1.0)

Copy Markdown View Source

Pure, protocol-independent lifecycle owner for one Git toast.

Informational and successful toasts are timed. Warning and error toasts are sticky. Identity matching makes replacement safe against stale dismissal.

Summary

Functions

Returns whether this toast level should be auto-dismissed.

Dismisses the current toast manually.

Dismisses only when the expected identity is still current.

Returns whether a toast is currently present.

Publishes a latest-wins toast and advances its identity.

Records a timer handle only for the current timed toast identity.

Times out only a matching timed toast; sticky levels ignore timeout delivery.

Types

action()

@type action() :: :pull_and_retry | nil

id()

@type id() :: non_neg_integer()

level()

@type level() :: :info | :success | :warning | :error

t()

@type t() :: %MingaEditor.Shell.Traditional.GitToast{
  action: action(),
  id: id(),
  level: level() | nil,
  message: String.t() | nil,
  timer: reference() | nil
}

Functions

auto_dismiss?(git_toast)

@spec auto_dismiss?(t()) :: boolean()

Returns whether this toast level should be auto-dismissed.

dismiss(toast)

@spec dismiss(t()) :: t()

Dismisses the current toast manually.

dismiss(toast, id)

@spec dismiss(t(), id()) :: t()

Dismisses only when the expected identity is still current.

present?(git_toast)

@spec present?(t()) :: boolean()

Returns whether a toast is currently present.

publish(toast, message, level, action \\ nil)

@spec publish(t(), String.t(), level(), action()) :: t()

Publishes a latest-wins toast and advances its identity.

record_timer(toast, id, timer)

@spec record_timer(t(), id(), reference()) :: t()

Records a timer handle only for the current timed toast identity.

timeout(toast, id)

@spec timeout(t(), id()) :: t()

Times out only a matching timed toast; sticky levels ignore timeout delivery.