events

package
Version: v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Overview

events defines an event subscriber and dispatcher

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmitterInterface

type EmitterInterface interface {
	// Emit Sends an event to the subscribed listeners
	Emit(context.Context, Event)

	// Subscribe Returns a channel that receives emitted events
	Subscribe(context.Context) <-chan Event

	// UnsubscribeAll close all listeners channels
	UnsubscribeAll()
}

EmitterInterface Root interface for events dispatch

type Event

type Event interface{}

Event Is a base interface for events

type EventEmitter

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

EventEmitter Registers listeners and dispatches events to them

func (*EventEmitter) Emit

func (e *EventEmitter) Emit(ctx context.Context, evt Event)

func (*EventEmitter) Subscribe

func (e *EventEmitter) Subscribe(ctx context.Context) <-chan Event

func (*EventEmitter) UnsubscribeAll

func (e *EventEmitter) UnsubscribeAll()

Source Files

Jump to

Keyboard shortcuts

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