You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
observer is an Object .By default, the callback in subscribe will be placed in next.
letobserver={next(){},complete(){},error(){},};
Remember the promise we used so often, two states, resolve and reject. In observer we can manually execute Observer.complete () and Observer.error () to control the process.
letfoo=Rx.Observable.create(observer=>{observer.next(123);observer.next(456);observer.complete();observer.next(789);});foo.subscribe(x=>console.log(x));// 123 456, then nothing
hello world
when use RxJs
Concept
Observable
Observable is actually an asynchronous array
when using Observable
We can make a function return multiple times, which is very different from the original javascript function.
You can also create an event stream that prints the event object when the user clicks it.
observer
observer is an Object .By default, the callback in subscribe will be placed in next.
Remember the promise we used so often, two states, resolve and reject. In observer we can manually execute Observer.complete () and Observer.error () to control the process.
subscription
Subscription is the return value after subscribe
like can Interrupting Promise
The text was updated successfully, but these errors were encountered: