reloader

package
v0.0.0-...-6c6da76 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package reloader provides a method to load a file whenever it changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reloader

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

Reloader represents an ongoing reloader task.

func New

func New(filename string, dataCallback func([]byte) error, logger blog.Logger) (*Reloader, error)

New loads the filename provided, and calls the callback. It then spawns a goroutine to check for updates to that file, calling the callback again with any new contents. The first load, and the first call to callback, are run synchronously, so it is easy for the caller to check for errors and fail fast. New will return an error if it occurs on the first load. Otherwise all errors are sent to the callback.

func (*Reloader) Stop

func (r *Reloader) Stop()

Stop stops an active reloader, release its resources.

Jump to

Keyboard shortcuts

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