bootstrap

package module
v0.4.14 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT Imports: 10 Imported by: 73

README

This package allows you to quickly create a multi-window application using astilectron.

Check out the demo to see a working example with the bundler.

Important

  • by default all resources should be in a resources folder. If you want to put them in a different folder, be sure to provide its path with the ResourcesPath option
  • if one of your window's URL is a relative path you will need to put your app content in an app folder located in your resources folder

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(o Options) (err error)

Run runs the bootstrap

func SendMessage

func SendMessage(w *astilectron.Window, name string, payload interface{}, cs ...CallbackMessage) error

SendMessage sends a message

Types

type Asset

type Asset func(name string) ([]byte, error)

Asset is a function that retrieves an asset content namely the go-bindata's Asset method

type AssetDir

type AssetDir func(name string) ([]string, error)

AssetDir is a function that retrieves an asset dir namely the go-bindata's AssetDir method

type AstilectronAdapter

type AstilectronAdapter func(w *astilectron.Astilectron)

AstilectronAdapter is a function that adapts the astilectron instance

type CallbackMessage

type CallbackMessage func(m *MessageIn)

CallbackMessage represents a bootstrap message callback

type MessageHandler

type MessageHandler func(w *astilectron.Window, m MessageIn) (payload interface{}, err error)

MessageHandler is a functions that handles messages

type MessageIn

type MessageIn struct {
	Name    string          `json:"name"`
	Payload json.RawMessage `json:"payload,omitempty"`
}

MessageIn represents a message going in

type MessageOut

type MessageOut struct {
	Name    string      `json:"name"`
	Payload interface{} `json:"payload,omitempty"`
}

MessageOut represents a message going out

type OnWait

type OnWait func(a *astilectron.Astilectron, w []*astilectron.Window, m *astilectron.Menu, t *astilectron.Tray, tm *astilectron.Menu) error

OnWait is a function that executes custom actions before waiting

type Options

type Options struct {
	Adapter            AstilectronAdapter
	Asset              Asset
	AssetDir           AssetDir
	AstilectronOptions astilectron.Options
	Debug              bool
	IgnoredSignals     []os.Signal
	Logger             astikit.StdLogger
	MenuOptions        []*astilectron.MenuItemOptions
	MenuOptionsFunc    func(*astilectron.Astilectron) []*astilectron.MenuItemOptions
	OnWait             OnWait
	ResourcesPath      string
	RestoreAssets      RestoreAssets
	TrayMenuOptions    []*astilectron.MenuItemOptions
	TrayOptions        *astilectron.TrayOptions
	Windows            []*Window
}

Options represents options

type RestoreAssets

type RestoreAssets func(dir, name string) error

RestoreAssets is a function that restores assets namely the go-bindata's RestoreAssets method

type Window

type Window struct {
	Adapter        WindowAdapter
	Homepage       string
	MessageHandler MessageHandler
	Options        *astilectron.WindowOptions
}

Options to setup and create a new window

type WindowAdapter

type WindowAdapter func(w *astilectron.Window)

WindowAdapter is a function that adapts a window

Jump to

Keyboard shortcuts

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