trigger

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func() error

Callback used as a trigger execution process.

type Trigger

type Trigger interface {
	io.Closer
	Timer() time.Duration
	IsStopped() bool
	Stop() error
}

Trigger defines the interface of a trigger instance

func NewPulseTrigger added in v1.11.0

func NewPulseTrigger(delay time.Duration, callback Callback) (Trigger, error)

NewPulseTrigger instantiate a new pulse trigger that will execute a callback method after a determined amount of time.

func NewRecurringTrigger added in v1.11.0

func NewRecurringTrigger(period time.Duration, callback Callback) (Trigger, error)

NewRecurringTrigger instantiate a new trigger that will execute a callback method recurrently with a defined periodicity.

Jump to

Keyboard shortcuts

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