Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultIgnore = watch.DefaultIgnore
DefaultIgnore contains a list of files that you usually want to ignore. Such as temporary files, hidden files, log files and binaries.
View Source
var Script string
Script is reloading script for server.
Functions ¶
func DisableCache ¶ added in v0.5.1
func DisableCache(w http.ResponseWriter)
DisableCache sets headers to disable response caching.
Types ¶
type Change ¶
type Change struct { // Kind is one of "create", "modify", "delete" Kind string `json:"kind"` // Path rewriting TODO: Path string `json:"path"` // Modified returns the modified time of the file. Modified time.Time `json:"modified"` // Action is the action browser should take with this file. Action Action `json:"action"` // Package finds match based on `package("<pkgname>", function(){` Package string `json:"package"` // Depends finds text based on `depends("<pkgname>")` Depends []string `json:"depends"` }
Change defines a list of changes.
type Config ¶
type Config struct { // Interval defines how often to poll the disk. Interval time.Duration // Monitor these globs for changes. Monitor []string // Ignore these globs to avoid unnecessary updates. Ignore []string // Care only monitor files that match these globs. Care []string // URL where the watchjs server is serving on. // Code defaults to using the request.URL otherwise. URL string // ManualScriptSetup allows to disable automatic setup of js reloading script. ManualScriptSetup bool // ReconnectInterval defines how fast watchjs tries to reconnect after losing connection to the server. ReconnectInterval time.Duration // OnChange should return the URL path for a particular file and the reaction for javascript. OnChange func(change watch.Change) (path string, reaction Action) }
Config is configures server for modifications.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub dispatches Message to multiple listeners.
func (*Hub) Unregister ¶
Unregister removes connection from hub.
type Listener ¶
type Listener interface { // Dispatch must not block Dispatch(Message) }
Listener is a connection that cares about the changes.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server responds to regular requests with watchjs.Script and handles incoming websockets.
func (*Server) ReloadBrowser ¶
func (server *Server) ReloadBrowser()
ReloadBrowser sends a reload message to all connected browsers.
Click to show internal directories.
Click to hide internal directories.