messenger

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Colors

type Colors struct {
	Error   string `jsc:"error"`
	Warning string `jsc:"warning"`
	Info    string `jsc:"info"`
	Success string `jsc:"success"`
}

type Messenger

type Messenger interface {

	// Display an error message
	Error(duration time.Duration, args ...any)

	// Display a warning message
	Warning(duration time.Duration, args ...any)

	// Display an info message
	Info(duration time.Duration, args ...any)

	// Display a success message
	Success(duration time.Duration, args ...any)
}

A messenger which will display messages to the user

func New

func New(style Styling) Messenger

Create a new messenger

type OnClickFunc

type OnClickFunc func()

func (OnClickFunc) OnClick

func (f OnClickFunc) OnClick()

type OnClicker

type OnClicker interface {
	OnClick()
}

type SimpleMessenger

type SimpleMessenger struct {
	// The element which will be used to display messages
	Element js.Value `jsc:"element"`
	// Foreground and background colors for the message
	Colors Styling `jsc:"contrast"`
}

func (*SimpleMessenger) Error

func (m *SimpleMessenger) Error(duration time.Duration, args ...any)

Display an error message

func (*SimpleMessenger) Info

func (m *SimpleMessenger) Info(duration time.Duration, args ...any)

Display an info message

func (*SimpleMessenger) Success

func (m *SimpleMessenger) Success(duration time.Duration, args ...any)

Display a success message

func (*SimpleMessenger) Warning

func (m *SimpleMessenger) Warning(duration time.Duration, args ...any)

Display a warning message

type Styling

type Styling struct {
	ForeGround Colors `jsc:"foreGround"`
	BackGround Colors `jsc:"backGround"`
	FontSize   string `jsc:"fontSize"`
	Padding    string `jsc:"padding"`
}

Jump to

Keyboard shortcuts

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