hotreload

package
v0.0.0-...-bf366bc Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: ISC Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EndpointPath is a path to websocket endpoint
	EndpointPath = "/.gostatic.hotreload"
	// ScriptPath is a path to hotreload support js
	ScriptPath = "/.gostatic.hotreload.js"
)

Variables

View Source
var (
	Head  = []byte(`</head>`)
	Entry = []byte(`<script src="/.gostatic.hotreload.js" async></script></head>`)
)
View Source
var Morphdom []byte
View Source
var Script []byte

Functions

func ServeHTTP

func ServeHTTP(source, port string, hotreload bool) error

ServeHTTP serves files from `dir` and adds hotreload support to html files

func Watch

func Watch(dirs, files []string, callback func()) error

Watch starts file watcher

Types

type Broker

type Broker struct {
	// Events are pushed to this channel by the main events-gathering routine
	Notifier chan []byte
	// contains filtered or unexported fields
}

func NewServer

func NewServer() (broker *Broker)

func (*Broker) ServeHTTP

func (broker *Broker) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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