Created
May 9, 2017 23:08
-
-
Save tuan/2c6c8c70291f0aef7d790ec478c9b035 to your computer and use it in GitHub Desktop.
RxJS bindcallback's stream completes after first emit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jsbin https://jsbin.com/xeyugac/edit?js,console | |
const { Observable } = Rx; | |
const testFn = (callback) => { | |
callback(1,2); | |
}; | |
const testFnAsObservable = Observable.bindCallback(testFn); | |
const obs = testFnAsObservable(); | |
obs.subscribe( | |
value => console.log('value', value), | |
error => console.error(error), | |
() => console.log('complete!') | |
); | |
// output | |
// value [1,2] | |
// complete! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment