wails_store

package
v0.0.0-...-758e8b3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

func NewStore

func NewStore(rt *runtime.Runtime, name string, defaultValue interface{}) *Store

New creates a new store

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

func (*Store) UseAsyncCallbacks

func (s *Store) UseAsyncCallbacks(enable bool)

Jump to

Keyboard shortcuts

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