livereload

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package livereload implements HTML5 Server Side Events to live reload connected browsers Usage: first start the livereload instance

liveReload := livereload.New(serv.src)
liveReload.Start()

then, install an HTTP handler on desired path

http.Handle("/livereload", liveReload)

The target browser must support HTML5 Server Side Events.

Index

Constants

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

Snippet is a minimal javascript client for browsers. Embed it 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 them

func New

func New(root string) *LiveReload

New creates a new LiveReload struct

func (*LiveReload) ServeHTTP

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

ServeHTTP is a request handler for http requests

func (*LiveReload) Start

func (livereload *LiveReload) Start()

Start manages connections and broadcasts messages to connected clients

Jump to

Keyboard shortcuts

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