mrevent

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventPool added in v0.10.0

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

EventPool - thread safe structure stores events, their handlers and functions for management

func NewEventPool

func NewEventPool(bufferSize uint32) *EventPool

func (*EventPool) Emit added in v0.10.0

func (e *EventPool) Emit(eventName string, args mrcore.EventArgs) error

Emit - Call eventName there

func (*EventPool) EmitWithContext added in v0.10.0

func (e *EventPool) EmitWithContext(ctx context.Context, eventName string, args mrcore.EventArgs) error

EmitWithContext - Call eventName there

func (*EventPool) Has added in v0.10.0

func (e *EventPool) Has(eventName string) bool

Has - Checks if there are listeners for the passed eventName

func (*EventPool) List added in v0.10.0

func (e *EventPool) List() []string

List - Returns a list of events that listeners are subscribed to

func (*EventPool) Listen added in v0.10.0

func (e *EventPool) Listen(eventName string, handlerFunc mrcore.EventHandlerFunc)

Listen - Subscribe on eventName

func (*EventPool) Remove added in v0.10.0

func (e *EventPool) Remove(eventNames ...string)

Remove - Removes listeners by event name Removing listeners closes subscribers and stops the goroutine.

If you call the function without the "names" parameter, all listeners of all events will be removed.

func (*EventPool) Wait added in v0.10.0

func (e *EventPool) Wait()

Wait - Blocks the thread until all running events are completed

Jump to

Keyboard shortcuts

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