Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 767 Bytes

do.md

File metadata and controls

68 lines (47 loc) · 767 Bytes

Do Operator

Overview

Register an action to take upon a variety of Observable lifecycle events.

Instances

  • DoOnNext
  • DoOnError
  • DoOnCompleted

Each one returns a <-chan struct{} that closes once the Observable terminates.

Example

DoOnNext

<-rxgo.Just(1, 2, 3)().
	DoOnNext(func(i interface{}) {
		fmt.Println(i)
	})

Output:

1
2
3

DoOnError

<-rxgo.Just(1, 2, errors.New("foo"))().
	DoOnError(func(err error) {
		fmt.Println(err)
	})

Output:

foo

DoOnCompleted

<-rxgo.Just(1, 2, 3)().
	DoOnCompleted(func() {
		fmt.Println("done")
	})

Output:

done

Options