chanutil

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebouncedChan

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

DebouncedChan is a function that will only be called once per cooldown period, at the leading edge. If it is called again during the cooldown, the subsequent calls are delayed until the cooldown period has elapsed and are also coalesced into a single call.

func NewDebouncedChan

func NewDebouncedChan(ctx context.Context, cooldown time.Duration) *DebouncedChan

NewDebouncedChan returns a new DebouncedChan which sends on the channel no more often than the cooldown period.

func (*DebouncedChan) C

func (d *DebouncedChan) C() <-chan struct{}

func (*DebouncedChan) Call

func (d *DebouncedChan) Call()

Jump to

Keyboard shortcuts

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