afkdetect

package
v0.0.0-...-d280c18 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package afkdetect contains code to detect if the user has gone AFK or returned from AFK.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrObserverIsNil = errors.New("observer is nil")
)

Errors specific to AFK-detectors.

Functions

This section is empty.

Types

type Detector

type Detector interface {
	// Start makes this detector start listening for OS-specific events to then
	// trigger AFK-started or AFK-stopped events.
	//
	// You need to stop the detector to remove any dangling Goroutines.
	StartDetecting() error
	// StopDetecting makes this detector stop listening for OS-specific events by
	// cleaning up its Goroutines and hooks.
	StopDetecting() error

	StartedObs() *chans.PubSub[Started]
	StoppedObs() *chans.PubSub[Stopped]
}

Detector is an AFK-detector.

func New

func New() Detector

New creates a new AFK-detector.

type Started

type Started struct{}

Started contains event data for when user has gone AFK.

type Stopped

type Stopped struct {
}

Stopped contains event data for when user is no longer AFK (after being AFK).

Jump to

Keyboard shortcuts

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