Documentation ¶
Overview ¶
Package loader provides primitives to load an applet both when the underlying file changes and on demand when an update is requested.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader is a structure to provide applet loading when a file changes or on demand.
func NewLoader ¶
func NewLoader( fs fs.FS, watch bool, fileChanges chan bool, updatesChan chan Update, maxDuration int, timeout int, renderGif bool, ) (*Loader, error)
NewLoader instantiates a new loader structure. The loader will read off of fileChanges channel and write updates to the updatesChan. Updates are base64 encoded WebP strings. If watch is enabled, both file changes and on demand requests will send updates over the updatesChan.
func (*Loader) CallSchemaHandler ¶ added in v0.16.0
func (*Loader) LoadApplet ¶
LoadApplet loads the applet on demand.
TODO: This method is thread safe, but has a pretty glaring race condition. If two callers request an update at the same time, they have the potential to get each others update. At the time of writing, this method is only called when you refresh a webpage during app development - so it doesn't seem likely that it's going to cause issues in the short term.