What is the difference between Observable.create and Observable.createWithDisposable? I can't see the difference from the documentation or by looking at the source code.
[create] is an alias for the
createWithDisposablemethod.
https://github.com/Reactive-Extensions/RxJS/blob/d94905a34ba9953e705975acce136c0d0dbd495e/doc/api/core/operators/create.md
The two functions are interchangeable. createWithDisposable has been deprecated. You should use create.
create function can return a function that will be called when subscription is disposed (this function must be used to clean up).
var source,
subscription;
source = Rx.Observable.create(function (observer) {
// ..
return function () {
console.log('disposed');
};
});
subscription = source.subscribe();
subscription.dispose();
<script src='https://rawgit.com/Reactive-Extensions/RxJS/v.2.5.3/dist/rx.all.js'></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With