toaster

package
v0.0.0-...-9a52c18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DangerType  = "danger"
	WarningType = "warning"
	SuccessType = "success"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler() *Handler

func (*Handler) GetActionType

func (ctx *Handler) GetActionType() string

func (*Handler) GetDefaultState

func (ctx *Handler) GetDefaultState() any

func (*Handler) GetName

func (ctx *Handler) GetName() string

func (*Handler) Handle

type HandlerArguments

type HandlerArguments struct {
	Operation string  `json:"operation"`
	Value     Message `json:"value"`
}

type Message

type Message struct {
	ID      string `json:"id"`
	Typ     string `json:"typ"`
	Open    bool   `json:"open"`
	Message string `json:"message"`
	Ttl     int    `json:"ttl"`
}

type State

type State struct {
	MaxMessages int       `json:"maxMessages"`
	Messages    []Message `json:"messages"`
	// contains filtered or unexported fields
}

func NewState

func NewState() *State

func (*State) AddMessage

func (ctx *State) AddMessage(msg Message) Message

func (*State) GetOldestMessage

func (ctx *State) GetOldestMessage() (Message, error)

func (*State) MessagePoolFull

func (ctx *State) MessagePoolFull() bool

func (*State) RemoveMessage

func (ctx *State) RemoveMessage(msg Message)

func (*State) SetMaxMessages

func (ctx *State) SetMaxMessages(count int)

func (*State) UpdateOpenState

func (ctx *State) UpdateOpenState(ID string, open bool)

type Toaster

func NewToaster

func NewToaster() *Toaster

func (*Toaster) Name

func (ctx *Toaster) Name() string

func (*Toaster) Render

func (ctx *Toaster) Render() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL