live

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package live broadcasts the moves in a web view.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type View

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

View represents a live web view.

func New

func New(static fs.FS, port int, logger *log.Logger) (*View, chan error, error)

New creates a new live view.

func (*View) ServeHTTP

func (v *View) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface.

func (*View) Shutdown

func (v *View) Shutdown() error

Shutdown shuts down the live view gracefully.

func (*View) Update

func (v *View) Update(move *chess.Move, position *chess.Position) error

Update updates the live view with the latest move and position.

func (*View) Wait

func (v *View) Wait(ctx context.Context)

Wait awaits that the user confirms the view is live.

Jump to

Keyboard shortcuts

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