subscription

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager[T any] struct {
	// contains filtered or unexported fields
}

Manager is a subscription manager - allows for thread-safe registering/unregistering subscribers of type T

func NewManager

func NewManager[T any]() *Manager[T]

NewManager creates a new subscription manager

func (*Manager[T]) Subscribe

func (m *Manager[T]) Subscribe(subscriber T) func()

Subscribe adds a new subscriber, returns an unsubscribe function

func (*Manager[T]) Subscribers

func (m *Manager[T]) Subscribers() []T

Subscribers returns a list of all subscribers

Jump to

Keyboard shortcuts

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