Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

经实测 buffer 第一个 500毫秒不会发出500毫秒时刻的值 #4

Closed
wants to merge 1 commit into from

Conversation

weiwang94
Copy link

我使用 angular 6.0.3, rxjs 使用 6.2.2 版本,按照你们的方法使用 buffer, 得出不一样的输出,代码如下

    let scissor = interval(500)
    let emitter = interval(100)
    // 会生成 10 个 值
    let timeTake = take(10)
    let emitterTake = timeTake(emitter)

    let rxBuffer =  buffer(scissor)
    let stream$ = rxBuffer(emitterTake)
    stream$.subscribe(d => {
        // 500 毫秒后 生成 [ 0, 1, 2, 3]
        // 再过 500 毫秒后 生成 [4, 5, 6, 7,8]
        console.log('d', d)
    })

``

@weiwang94
Copy link
Author

对不起没看到 你写的 rxjs 5 版本

    let scissor = interval(500)
    let stream$ = interval(100).pipe(take(10), tap(i => console.log('i', i)),buffer(scissor))

    stream$.subscribe(d => {
        // 500 毫秒后 生成 [ 0, 1, 2, 3]
        // 再过 500 毫秒后 生成 [4, 5, 6, 7,8]
        console.log('d', d)
    })

这是我的调试代码, 发现第一个 500毫秒确实没有发出第 5 个值

@SangKa
Copy link
Member

SangKa commented Sep 19, 2018

版本的不一致性可能会带来诸如此类的问题。
近日将此仓库同步至最新版本 (#6 ),届时可以再用 RxJS 6 尝试。

@SangKa SangKa closed this Sep 19, 2018
SangKa pushed a commit that referenced this pull request Sep 19, 2018
fixed fnError error code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants