Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RxJS bindcallback's stream completes after first emit
// 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