emitr

package module
v0.0.0-...-eb43f74 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 1 Imported by: 1

README

emitr

Emitr is a simple event emitter library package for Golang.

Features
  • Add multiple callback functions
  • Group callback functions by name
  • Run callback functions by event name
  • Add callback functions which are run only once
  • Add callback functions which are run on every event
Installation
go get github.com/abcum/emitr

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

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

Emitter represents an event emitter.

func (*Emitter) Emit

func (e *Emitter) Emit(name string)

Emit runs callbacks for the specified event name, and ensures that one-off events, are removed when the event has finished emitting.

func (*Emitter) Once

func (e *Emitter) Once(name string, fn func())

Once adds a callback which is called only once when an event is emitted, and then removed immediately after.

func (*Emitter) When

func (e *Emitter) When(name string, fn func())

When adds a callback which is called each and every time that an event is emitted.

Jump to

Keyboard shortcuts

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