splash

package
v1.3.343 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Single

func Single(f func() error) func(s *State) (Status, error)

Single wraps a simple function into a splash screen step.

Types

type State

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

State represents the current splash screen state.

func (*State) Current

func (s *State) Current() (string, float64)

Current returns the current progress bar content.

func (*State) Enter

func (s *State) Enter(step string, stepName string, errPrefix string, f func(s *State) (Status, error)) (Status, error)

Enter enters a splash screen section. step must be an unique string identifying what is being loaded. f is allowed to call Enter too, but must return false, nil if its own Enter calls returned false. f must repeat all Enter calls it does, but will never be called again once it returned true.

func (*State) ProvideFractions

func (s *State) ProvideFractions(fractions map[string]float64)

ProvideFractions loads a known fractions map. This should have been dumped by a previous run.

func (*State) ToFractions

func (s *State) ToFractions() map[string]float64

ToFractions returns the init fraction map by step. This can be provided via ProvideFractions next time.

type Status

type Status int
const (
	EndFrame Status = iota
	Continue
)

func RunImmediately

func RunImmediately(errPrefix string, f func(s *State) (Status, error)) (Status, error)

RunImmediately runs the given status-ish function as a single step. Useful for doing stuff w/o an actual loading screen.

Jump to

Keyboard shortcuts

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