go-observable: github.com/GianlucaGuarini/go-observable Index | Files

package observable

import "github.com/GianlucaGuarini/go-observable"

Index

Package Files

helpers.go observable.go

Constants

const ALL_EVENTS_NAMESPACE = "*"

event key uset to listen and remove all the events

type Observable Uses

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

Public Observable struct

func New Uses

func New() *Observable

New - returns a new observable reference

func (*Observable) Off Uses

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

Off - stop listening a particular event

func (*Observable) On Uses

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

On - adds a callback function

func (*Observable) One Uses

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

One - call the callback only once

func (*Observable) Trigger Uses

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

Trigger - a particular event passing custom arguments

Package observable imports 3 packages (graph) and is imported by 6 packages. Updated 2018-01-27. Refresh now. Tools for package owners.