Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. //RxJs Subscriber class constructor
  2. constructor(destinationOrNext?: PartialObserver<any> | ((value: T) => void), error?: (e?: any) => void,complete?: () => void) {
  3. super();
  4.  
  5. switch (arguments.length) {
  6. case 0:
  7. this.destination = emptyObserver;
  8. break;
  9. case 1:
  10. if (!destinationOrNext) {
  11. this.destination = emptyObserver;
  12. break;
  13. }
  14. if (typeof destinationOrNext === 'object') {
  15. if (destinationOrNext instanceof Subscriber) {
  16. this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
  17. this.destination = destinationOrNext;
  18. destinationOrNext.add(this);
  19. } else {
  20. this.syncErrorThrowable = true;
  21. this.destination = new SafeSubscriber<T>(this, <PartialObserver<any>> destinationOrNext);
  22. }
  23. break;
  24. }
  25. default:
  26. this.syncErrorThrowable = true;
  27. this.destination = new SafeSubscriber<T>(this, <((value: T) => void)> destinationOrNext, error, complete);
  28. break;
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement