fix: fix example function bug in function package

This commit is contained in:
dudaodong
2023-01-08 21:09:41 +08:00
parent bce3641ec6
commit d95a7c6101
2 changed files with 6 additions and 14 deletions

View File

@@ -108,21 +108,21 @@ func ExampleDebounced() {
}
func ExampleSchedule() {
var result []string
count := 0
appendFn := func(s string) {
result = append(result, s)
increase := func() {
count++
}
stop := Schedule(1*time.Second, appendFn, "*")
stop := Schedule(1*time.Second, increase)
time.Sleep(3 * time.Second)
close(stop)
fmt.Println(result)
fmt.Println(count)
// Output:
// [* * *]
// 3
}
func ExamplePipeline() {