tool

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Publisher

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

func NewPublisher

func NewPublisher[T any]() *Publisher[T]

func (*Publisher[T]) GetSubscriberCount

func (p *Publisher[T]) GetSubscriberCount() int

func (*Publisher[T]) Publish

func (p *Publisher[T]) Publish(event T)

func (*Publisher[T]) Subscribe

func (p *Publisher[T]) Subscribe(subscriber Subscriber[T])

func (*Publisher[T]) Unsubscribe

func (p *Publisher[T]) Unsubscribe(subscriberID string)

type Subscriber

type Subscriber[T any] interface {
	OnEvent(event T)
	GetID() string
}

Jump to

Keyboard shortcuts

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