RxGo: github.com/ReactiveX/RxGo/observer Index | Files

package observer

import "github.com/ReactiveX/RxGo/observer"


Package Files

observer.go observer_mock.go


var DefaultObserver = Observer{
    NextHandler: func(interface{}) {},
    ErrHandler:  func(err error) {},
    DoneHandler: func() {},

DefaultObserver guarantees any handler won't be nil.

type Observer Uses

type Observer struct {
    NextHandler handlers.NextFunc
    ErrHandler  handlers.ErrFunc
    DoneHandler handlers.DoneFunc

Observer represents a group of EventHandlers.

func New Uses

func New(eventHandlers ...rx.EventHandler) Observer

New constructs a new Observer instance with default Observer and accept any number of EventHandler

func (Observer) Handle Uses

func (ob Observer) Handle(item interface{})

Handle registers Observer to EventHandler.

func (Observer) OnDone Uses

func (ob Observer) OnDone()

OnDone terminates the Observer's internal Observable

func (Observer) OnError Uses

func (ob Observer) OnError(err error)

OnError applies Observer's ErrHandler to an error

func (Observer) OnNext Uses

func (ob Observer) OnNext(item interface{})

OnNext applies Observer's NextHandler to an Item

type ObserverMock Uses

type ObserverMock struct {

func NewObserverMock Uses

func NewObserverMock() *ObserverMock

func (*ObserverMock) Capture Uses

func (m *ObserverMock) Capture() Observer

func (*ObserverMock) OnDone Uses

func (m *ObserverMock) OnDone()

OnDone provides a mock function with given fields:

func (*ObserverMock) OnError Uses

func (m *ObserverMock) OnError(err error)

OnError provides a mock function with given fields: err

func (*ObserverMock) OnNext Uses

func (m *ObserverMock) OnNext(item interface{})

OnNext provides a mock function with given fields: item

Package observer imports 3 packages (graph). Updated 2018-11-05. Refresh now. Tools for package owners.