bootstrap

package module
v0.0.0-...-9e5822a Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2017 License: MIT Imports: 7 Imported by: 1

README

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

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

Installation

Run the following command:

$ go get -u github.com/asticode/go-astilectron-bootstrap

Prerequisites

Files structure

You must follow the following files structure:

|--+ resources
    |
    |--+ app (contains your static files such as .html, .css, .js, .png, etc.)
        |
        |--+ css (not mandatory, for example purposes)
        |
        |--+ html (not mandatory, for example purposes)
        |
        |--+ js (not mandatory, for example purposes)
|--+ main.go

Example

Check out the demo that uses the bootstrap and the bundler.

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

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 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 {
	CallbackID *int            `json:"callbackId,omitempty"`
	Name       string          `json:"name"`
	Payload    json.RawMessage `json:"payload"`
}

MessageIn represents a message going in

type MessageOut

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

MessageOut represents a message going out

type OnWait

OnWait is a function that executes custom actions before waiting

type Options

type Options struct {
	Asset              Asset
	AstilectronOptions astilectron.Options
	Debug              bool
	Homepage           string
	MenuOptions        []*astilectron.MenuItemOptions
	MessageHandler     MessageHandler
	OnWait             OnWait
	RestoreAssets      RestoreAssets
	TrayMenuOptions    []*astilectron.MenuItemOptions
	TrayOptions        *astilectron.TrayOptions
	WindowOptions      *astilectron.WindowOptions
}

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

Jump to

Keyboard shortcuts

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