Documentation ¶
Index ¶
- Constants
- Variables
- func BasicAuth(auth func(user string, pass string) bool) func(http.HandlerFunc) http.HandlerFunc
- func NewHtmlRoot(html string) *simpleRoot
- func NewSimpleRoot(files map[string]string) *simpleRoot
- func OpenBrowser(pageURL string) error
- func OpenWebApp(url string, x, y, width, height int) error
- type Bindable
- type Binder
- type BindingFunc
- type Bindings
- func Delay(names []string, factory func(*UIContext) Bindings) Bindings
- func DelayMap(prototype map[string]interface{}, factory func(*UIContext) Bindings) Bindings
- func DelayObject(prototype interface{}, factory func(*UIContext) Bindings) Bindings
- func Func(name string, fn interface{}) Bindings
- func Map(m map[string]interface{}) Bindings
- func Object(obj interface{}) Bindings
- func Prefix(name string, b Bindings) Bindings
- type ClientOptions
- type Context
- type FileServer
- func (s *FileServer) Bind(b Bindings) error
- func (s *FileServer) Close() error
- func (s *FileServer) Done() <-chan struct{}
- func (s *FileServer) ListenAndServe() error
- func (s *FileServer) ListenAndServeTLS(certFile, keyFile string) error
- func (s *FileServer) ServeExistingServer(server HTTPServer)
- func (s *FileServer) ServeExistingServerTLS(server HTTPServer)
- func (s *FileServer) Shutdown(ctx context.Context) error
- type Function
- type HTTPServer
- type HTTPServerFunc
- type ObjectFactory
- type Option
- func AppWindow(x, y, width, height int) Option
- func BlurOnClose(blur bool) Option
- func HistoryMode(enable bool) Option
- func LocalExitDelay(d time.Duration) Option
- func LocalMapURL(mapURL func(net.Listener) string) Option
- func Mode(mod string) Option
- func OnlineAddr(addr string) Option
- func OnlineAttach(existingServer HTTPServer, tls bool) Option
- func OnlineAuth(auth func(http.HandlerFunc) http.HandlerFunc) Option
- func OnlineListener(listener net.Listener) Option
- func OnlinePort(port int) Option
- func OnlinePrefix(prefix string) Option
- func OnlineTLS(certFile, keyFile string) Option
- func OpenURL(fn func(string) error) Option
- func Quiet() Option
- func Root(root fs.FS) Option
- func RootFiles(files map[string]string) Option
- func RootHtml(html string) Option
- type Page
- type RunMode
- type UI
- type UIContext
- type Value
- type Window
- func NewChromeApp(root fs.FS, x, y int, width, height int, chromeArgs ...string) Window
- func NewChromeAppMapURL(root fs.FS, x, y int, width, height int, mapURL func(net.Listener) string, ...) Window
- func NewPage(root fs.FS, openURL func(string) error) Window
- func NewPageMapURL(root fs.FS, openURL func(string) error, mapURL func(net.Listener) string) Window
Constants ¶
View Source
const ContextBindingName = "context"
View Source
const ReadyFuncName = "Gots"
ReadyFuncName is an async ready function in api object.
Variables ¶
View Source
var ChromeBinary string
Functions ¶
func BasicAuth ¶
func BasicAuth(auth func(user string, pass string) bool) func(http.HandlerFunc) http.HandlerFunc
func NewHtmlRoot ¶
func NewHtmlRoot(html string) *simpleRoot
func NewSimpleRoot ¶
func OpenBrowser ¶ added in v0.1.4
func OpenWebApp ¶ added in v0.1.4
Types ¶
type BindingFunc ¶
type BindingFunc interface{}
type Bindings ¶
type Bindings interface { Names() []string Map(*UIContext) map[string]BindingFunc Error() error }
Bindings represent an api. Every binding has a name and a callable object.
func DelayObject ¶
type ClientOptions ¶
type ClientOptions struct {
BlurOnClose bool
}
type Context ¶
type Context struct { Seq int `json:"seq"` // contains filtered or unexported fields }
func (*Context) WithCancel ¶
func (c *Context) WithCancel() context.CancelFunc
type FileServer ¶
type FileServer struct { Addr string ServerPath string Listener net.Listener Prefix string // path prefix Auth func(http.HandlerFunc) http.HandlerFunc HistoryMode bool ClientOptions *ClientOptions // contains filtered or unexported fields }
func NewFileServer ¶
func NewFileServer(root fs.FS) *FileServer
func (*FileServer) Bind ¶
func (s *FileServer) Bind(b Bindings) error
func (*FileServer) Close ¶
func (s *FileServer) Close() error
func (*FileServer) Done ¶
func (s *FileServer) Done() <-chan struct{}
func (*FileServer) ListenAndServe ¶
func (s *FileServer) ListenAndServe() error
func (*FileServer) ListenAndServeTLS ¶
func (s *FileServer) ListenAndServeTLS(certFile, keyFile string) error
func (*FileServer) ServeExistingServer ¶
func (s *FileServer) ServeExistingServer(server HTTPServer)
func (*FileServer) ServeExistingServerTLS ¶
func (s *FileServer) ServeExistingServerTLS(server HTTPServer)
type Function ¶
type Function struct { BindingName string `json:"bindingName"` Seq int `json:"seq"` // contains filtered or unexported fields }
Function wraps a js callback function.
type HTTPServer ¶
type HTTPServerFunc ¶
type ObjectFactory ¶
type ObjectFactory func(*UIContext) interface{}
type Option ¶
type Option func(*uiConfig) error
func BlurOnClose ¶
func HistoryMode ¶
func LocalExitDelay ¶
LocalExitDelay contorl auto exit behaviour of a local server. By default, when all clients where lost, a local server will wait for a new client and exit if timeout. A local server will exit immediately after any client lost when duration is 0, and never exit when duration is less than 0.
func OnlineAddr ¶
func OnlineAttach ¶
func OnlineAttach(existingServer HTTPServer, tls bool) Option
func OnlineAuth ¶
func OnlineAuth(auth func(http.HandlerFunc) http.HandlerFunc) Option
func OnlineListener ¶
func OnlinePort ¶
func OnlinePrefix ¶
type Page ¶
type Page interface { Bind(name string, f interface{}) error Eval(js string) Value SetReady() error // nofity server ready ( all functions binded ) Close() Done() <-chan struct{} }
Page of a javascript client.
type Value ¶
type Value interface { Err() error To(interface{}) error Float() float32 Int() int String() string Bool() bool Object() map[string]Value Array() []Value }
Value is JSON value or error.
type Window ¶
type Window interface { Bind(b Bindings) error Open() error Server() *FileServer SetExitDelay(d time.Duration) Eval(js string) Value Done() <-chan struct{} Close() error }
func NewChromeApp ¶ added in v0.1.4
func NewChromeAppMapURL ¶ added in v0.1.4
Click to show internal directories.
Click to hide internal directories.