runtime

package
v2.0.0-alpha.62 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 16 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 Dialog

type Dialog interface {
	Open(dialogOptions *dialogoptions.OpenDialog) []string
	Save(dialogOptions *dialogoptions.SaveDialog) string
	Message(dialogOptions *dialogoptions.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 {
	UpdateApplicationMenu()
	UpdateContextMenu(contextMenu *menu.ContextMenu)
	SetTrayMenu(trayMenu *menu.TrayMenu)
	DeleteTrayMenu(trayMenu *menu.TrayMenu)
	UpdateTrayMenuLabel(trayMenu *menu.TrayMenu)
}

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
	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) *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 Window

type Window interface {
	Close()
	Center()
	Show()
	Hide()
	Maximise()
	Unmaximise()
	Minimise()
	Unminimise()
	SetTitle(title string)
	SetSize(width int, height int)
	SetMinSize(width int, height int)
	SetMaxSize(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