Skip to content

Latest commit

 

History

History
63 lines (42 loc) · 1.17 KB

window.md

File metadata and controls

63 lines (42 loc) · 1.17 KB

Window Operator

Overview

Periodically subdivide items from an Observable into Observable windows and emit these windows rather than emitting the items one at a time.

Instances

  • WindowWithCount

  • WindowWithTime

  • WindowWithTimeOrCount

Example

observe := rxgo.Just(1, 2, 3)().WindowWithCount(2).Observe()

fmt.Println("First Observable")
for item := range (<-observe).V.(rxgo.Observable).Observe() {
	if item.Error() {
		return item.E
	}
	fmt.Println(item.V)
}

fmt.Println("Second Observable")
for item := range (<-observe).V.(rxgo.Observable).Observe() {
	if item.Error() {
		return item.E
	}
	fmt.Println(item.V)
}

Output:

First Observable
1
2
Second Observable
3

Options