jonsamwell angular-simple-shopping-cart

时间:2017-10-17 07:58:47

标签: angular reactivex

https://github.com/jonsamwell/angular-simple-shopping-cart/blob/master/src/app/services/shopping-cart.service.ts

this.subscriptionObservable = new Observable<ShoppingCart>((observer: Observer<ShoppingCart>) => {
  this.subscribers.push(observer);
  observer.next(this.retrieve());
  return () => {
    this.subscribers = this.subscribers.filter((obs) => obs !== observer); 
  };
});

有人可以解释这行代码吗?

0 个答案:

没有答案