web

package
v0.3.1-0...-ca91996 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 2 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InSmartphoneMode

func InSmartphoneMode() bool

InSmartphoneMode returns whether the css selector used for enabling smartphone UI currently matches.

func Log

func Log(level LogLevel, msg string)

Log writes the given message with the given loglevel to the console.

func LogGrouped

func LogGrouped(level LogLevel, msg, groupLabel string, collapsed bool, content ...string)

LogGrouped write the given message with the given loglevel to the console. It appends the content at the same level inside a group, each content item logged separately. group is initially collapsed when collapsed=true.

Types

type LogLevel

type LogLevel int

LogLevel describes the level at which logs are made

const (
	// LogDebug is the lowest log level, used for debugging
	LogDebug LogLevel = iota
	// LongInfo is used for logging informative messages
	LogInfo
	// LogWarn is used for logging warnings
	LogWarn
	// LogError is used for logging errors
	LogError
)

func (LogLevel) String

func (level LogLevel) String() string

type RequestMethod

type RequestMethod int

RequestMethod is an enum of known methods for Fetch.

const (
	// Get is a GET request
	Get RequestMethod = iota
	// Post is a POST request
	Post
	// Put is a PUT request
	Put
	// Delete is a DELETE request
	Delete
)

func (RequestMethod) String

func (r RequestMethod) String() string

type Server

type Server interface {
	// gives access to the server's context.
	server.Context
	// Fetch sends an HTTP request to the server with the given method and given
	// payload, at the path created from joining a base path with the given
	// subpath. The result JSON is deserialized into the given target.
	//
	// The base path is defined by the ServerState implementation.
	// subpath must be relative and may not begin with a slash. It may be empty.
	// If it is not empty, it will be joined with the base path using a slash.
	Fetch(method RequestMethod, subpath string, payload interface{}, target interface{})
}

Server is the web UI's interface to the server's state.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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