trigger

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: MIT Imports: 2 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 {
	Close()
	Timer() time.Duration
	IsStopped() bool
	Stop()
}

Trigger defines the interface of a trigger instance

func NewPulse

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

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

func NewRecurring

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

NewRecurring 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