livereload

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const Snippet = `` /* 227-byte string literal not displayed */

Snippet is a minimal javascript client for reloading browse Embed in your `index.html` using a script tag: <script>{{ LiveReload.Snippet }}</script>

Variables

This section is empty.

Functions

This section is empty.

Types

type LiveReload

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

LiveReload keeps track of connected browser clients and broadcasts messages to those connected browser clients.

func New

func New(root string) *LiveReload

New creates a new LiveReload struct

func (LiveReload) SendEvent

func (livereload LiveReload) SendEvent(res http.ResponseWriter, eventData string)

SendEvent is helper to create formatted SSE events based on event type and data.

func (*LiveReload) ServeHTTP

func (livereload *LiveReload) ServeHTTP(res http.ResponseWriter, req *http.Request)

ServeHTTP handler for `/livereload` urls

func (*LiveReload) Start

func (livereload *LiveReload) Start()

Start manages connections and broadcasts messages to current connected browser clients

Jump to

Keyboard shortcuts

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