timerstack

package
v0.0.0-...-d931726 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package timerstack provides a timer which can execute multiple delayed functions one after one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action func() bool

Action is the function being executed. If the function returns false, the timer stack stops executing after this function.

type TimerStack

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

TimerStack allows to stack multiple timers on top to be executed one after one.

func New

func New() *TimerStack

New returns a new empty TimerStack.

func (*TimerStack) After

func (ts *TimerStack) After(d time.Duration, a Action) *TimerStack

After adds a new timer to the stack which is executed after the given time delay after the last executed timer. On execution, a is executed. If this function returns false, the execution stops after this function.

func (*TimerStack) RunBlocking

func (ts *TimerStack) RunBlocking()

RunBlocking starts the timer queue blocking the current go-routine until all timers on the stack are executed or until the timer has been stoped.

func (*TimerStack) Stop

func (ts *TimerStack) Stop()

Stop stops the timer stack execution.

Jump to

Keyboard shortcuts

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