Version: v1.16.9 Latest Latest

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

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 19 Imported by: 0



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



This section is empty.


View Source
var BridgeJS []byte
View Source
var InitJS []byte
View Source
var WailsCSS string
View Source
var WailsJS string


func ProcessEncoding added in v0.19.0

func ProcessEncoding(text string) string

ProcessEncoding attempts to convert CKJ strings to UTF-8


type Browser

type Browser struct{}

Browser exposes browser methods to the runtime

func NewBrowser

func NewBrowser() *Browser

NewBrowser creates a new runtime Browser struct

func (*Browser) OpenFile

func (r *Browser) OpenFile(filePath string) error

OpenFile opens the given file in the system's default browser

func (*Browser) OpenURL

func (r *Browser) OpenURL(url string) error

OpenURL opens the given url in the system's default browser

type Dialog

type Dialog struct {
	// contains filtered or unexported fields

Dialog exposes an interface to native dialogs

func NewDialog

func NewDialog(renderer interfaces.Renderer) *Dialog

NewDialog creates a new Dialog struct

func (*Dialog) SelectDirectory

func (r *Dialog) SelectDirectory() string

SelectDirectory prompts the user to select a directory

func (*Dialog) SelectFile

func (r *Dialog) SelectFile(params ...string) string

SelectFile prompts the user to select a file

func (*Dialog) SelectSaveFile

func (r *Dialog) SelectSaveFile(params ...string) string

SelectSaveFile prompts the user to select a file for saving

type Events

type Events struct {
	// contains filtered or unexported fields

Events exposes the events interface

func NewEvents

func NewEvents(eventManager interfaces.EventManager) *Events

NewEvents creates a new Events struct

func (*Events) Emit

func (r *Events) Emit(eventName string, optionalData ...interface{})

Emit pass through

func (*Events) On

func (r *Events) On(eventName string, callback func(optionalData ...interface{}))

On pass through

func (*Events) OnMultiple added in v1.12.0

func (r *Events) OnMultiple(eventName string, callback func(optionalData ...interface{}), counter uint)

OnMultiple pass through

func (*Events) Once added in v1.12.0

func (r *Events) Once(eventName string, callback func(optionalData ...interface{}))

Once pass through

type FileSystem

type FileSystem struct{}

FileSystem exposes file system utilities to the runtime

func NewFileSystem

func NewFileSystem() *FileSystem

NewFileSystem creates a new FileSystem struct

func (*FileSystem) HomeDir

func (r *FileSystem) HomeDir() (string, error)

HomeDir returns the user's home directory

type Log

type Log struct{}

Log exposes the logging interface to the runtime

func NewLog

func NewLog() *Log

NewLog creates a new Log struct

func (*Log) New

func (r *Log) New(prefix string) *logger.CustomLogger

New creates a new logger

type Options added in v1.8.0

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 added in v1.8.0

type Runtime struct {
	Events     *Events
	Log        *Log
	Dialog     *Dialog
	Window     *Window
	Browser    *Browser
	FileSystem *FileSystem
	Store      *StoreProvider

Runtime is the Wails Runtime Interface, given to a user who has defined the WailsInit method

func NewRuntime added in v1.8.0

func NewRuntime(eventManager interfaces.EventManager, renderer interfaces.Renderer) *Runtime

NewRuntime creates a new Runtime struct

type Store added in v1.8.0

type Store struct {
	// contains filtered or unexported fields

Store is where we keep named data

func (*Store) Get added in v1.9.0

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

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

func (*Store) OnError added in v1.8.0

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

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

func (*Store) Set added in v1.8.0

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 added in v1.8.0

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 added in v1.8.0

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 added in v1.8.0

type StoreProvider struct {
	// contains filtered or unexported fields

StoreProvider is a struct that creates Stores

func NewStoreProvider added in v1.8.0

func NewStoreProvider(runtime *Runtime) *StoreProvider

NewStoreProvider creates new stores using the provided Runtime reference.

func (*StoreProvider) New added in v1.8.0

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

New creates a new store

type Window

type Window struct {
	// contains filtered or unexported fields

Window exposes an interface for manipulating the window

func NewWindow

func NewWindow(renderer interfaces.Renderer) *Window

NewWindow creates a new Window struct

func (*Window) Close

func (r *Window) Close()

Close shuts down the window and therefore the app

func (*Window) Fullscreen

func (r *Window) Fullscreen()

Fullscreen makes the window fullscreen

func (*Window) SetColour

func (r *Window) SetColour(colour string) error

SetColour sets the the window colour

func (*Window) SetMaxSize added in v1.13.0

func (r *Window) SetMaxSize(width, height int)

SetMaxSize sets the maximum size of a resizable window

func (*Window) SetMinSize added in v1.13.0

func (r *Window) SetMinSize(width, height int)

SetMinSize sets the minimum size of a resizable window

func (*Window) SetTitle

func (r *Window) SetTitle(title string)

SetTitle sets the the window title

func (*Window) UnFullscreen

func (r *Window) UnFullscreen()

UnFullscreen attempts to restore the window to the size/position before fullscreen

Jump to

Keyboard shortcuts

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