Back to godoc.org
github.com/GianlucaGuarini/go-observable

package observable

v0.0.0 (d386f00)
Latest Go to latest
Published: Aug 29, 2018 | License: MIT | Module: github.com/GianlucaGuarini/go-observable

Index

Constants

const ALL_EVENTS_NAMESPACE = "*"

event key uset to listen and remove all the events

type Observable

type Observable struct {
	Callbacks map[string][]callback
	*sync.RWMutex
}

Public Observable struct

func New

func New() *Observable

New - returns a new observable reference

func (*Observable) Off

func (o *Observable) Off(event string, args ...interface{}) *Observable

Off - stop listening a particular event

func (*Observable) On

func (o *Observable) On(event string, cb interface{}) *Observable

On - adds a callback function

func (*Observable) One

func (o *Observable) One(event string, cb interface{}) *Observable

One - call the callback only once

func (*Observable) Trigger

func (o *Observable) Trigger(event string, params ...interface{}) *Observable

Trigger - a particular event passing custom arguments

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier