runtime

package
v2.0.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

package runtime contains all the methods and data structures related to the runtime library of Wails. This includes both Go and JS runtimes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Browser

type Browser interface {
	Open(target string) error
}

Browser defines all browser related operations

type ContextMenus

type ContextMenus interface {
	On(menuID string, callback func(*menu.MenuItem, string))
	Update()
	GetByID(menuID string) *menu.MenuItem
	RemoveByID(id string) bool
}

ContextMenus defines all ContextMenu related operations

type Dialog

type Dialog interface {
	Open(dialogOptions *options.OpenDialog) []string
	Save(dialogOptions *options.SaveDialog) string
	Message(dialogOptions *options.MessageDialog) string
}

Dialog defines all Dialog related operations

type Events

type Events interface {
	On(eventName string, callback func(optionalData ...interface{}))
	Once(eventName string, callback func(optionalData ...interface{}))
	OnMultiple(eventName string, callback func(optionalData ...interface{}), maxCallbacks int)
	Emit(eventName string, optionalData ...interface{})
	OnThemeChange(callback func(darkMode bool))
}

Events defines all events related operations

type Log

type Log interface {
	Print(message string)
	Trace(message string)
	Debug(message string)
	Info(message string)
	Warning(message string)
	Error(message string)
	Fatal(message string)
	SetLogLevel(level logger.LogLevel)
}

Log defines all Log related operations

type Menu interface {
	On(menuID string, callback func(*menu.MenuItem))
	Update()
	GetByID(menuID string) *menu.MenuItem
	RemoveByID(id string) bool
}

Menu defines all Menu related operations

type Options

type Options struct {

	// The name of the store
	Name string

	// The runtime to attach the store to
	Runtime *Runtime

	// Indicates if notifying Go listeners should be notified of updates
	// synchronously (on the current thread) or asynchronously using
	// goroutines
	NotifySynchronously bool
}

Options defines the optional data that may be used when creating a Store

type Runtime

type Runtime struct {
	Browser     Browser
	Events      Events
	Window      Window
	Dialog      Dialog
	System      System
	Menu        Menu
	ContextMenu ContextMenus
	Tray        Tray
	Store       *StoreProvider
	Log         Log
	// contains filtered or unexported fields
}

Runtime is a means for the user to interact with the application at runtime

func New

func New(serviceBus *servicebus.ServiceBus, menu *menu.Menu, trayMenu *menu.Tray, contextMenus *menu.ContextMenus) *Runtime

New creates a new runtime

func (*Runtime) Quit

func (r *Runtime) Quit()

Quit the application

type Store

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

Store is where we keep named data

func (*Store) Get

func (s *Store) Get() interface{}

Get returns the value of the data that's kept in the current state / Store

func (*Store) OnError

func (s *Store) OnError(callback func(error))

OnError takes a function that will be called whenever an error occurs

func (*Store) Set

func (s *Store) Set(data interface{}) error

Set will update the data held by the store and notify listeners of the change

func (*Store) Subscribe

func (s *Store) Subscribe(callback interface{})

Subscribe will subscribe to updates to the store by providing a callback. Any updates to the store are sent to the callback

func (*Store) Update

func (s *Store) Update(updater interface{})

Update takes a function that is passed the current state. The result of that function is then set as the new state of the store. This will notify listeners of the change

type StoreProvider

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

StoreProvider is a struct that creates Stores

func (*StoreProvider) New

func (p *StoreProvider) New(name string, defaultValue interface{}) *Store

New creates a new store

type System

type System interface {
	IsDarkMode() bool
	Platform() string
	AppType() string
}

System defines all System related operations

type Tray

type Tray interface {
	NewTray(id string) *menu.Tray
	On(menuID string, callback func(*menu.MenuItem))
	Update(tray ...*menu.Tray)
	GetByID(menuID string) *menu.MenuItem
	RemoveByID(id string) bool
	SetLabel(label string)
	SetIcon(name string)
}

Tray defines all Tray related operations

type Window

type Window interface {
	Close()
	Center()
	Show()
	Hide()
	Maximise()
	Unmaximise()
	Minimise()
	Unminimise()
	SetTitle(title string)
	SetSize(width int, height int)
	SetPosition(x int, y int)
	Fullscreen()
	UnFullscreen()
	SetColour(colour int)
}

Window defines all Window related operations

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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