(Zone: ZoneType)
| 15 | } & Subscriber<any>; |
| 16 | |
| 17 | export function patchRxJs(Zone: ZoneType): void { |
| 18 | (Zone as any).__load_patch('rxjs', (global: any, Zone: ZoneType, api: _ZonePrivate) => { |
| 19 | const symbol: (symbolString: string) => string = (Zone as any).__symbol__; |
| 20 | const nextSource = 'rxjs.Subscriber.next'; |
| 21 | const errorSource = 'rxjs.Subscriber.error'; |
| 22 | const completeSource = 'rxjs.Subscriber.complete'; |
| 23 | |
| 24 | const ObjectDefineProperties = Object.defineProperties; |
| 25 | |
| 26 | const patchObservable = function () { |
| 27 | const ObservablePrototype: any = Observable.prototype; |
| 28 | const _symbolSubscribe = symbol('_subscribe'); |
| 29 | const _subscribe = (ObservablePrototype[_symbolSubscribe] = ObservablePrototype._subscribe); |
| 30 | |
| 31 | ObjectDefineProperties(Observable.prototype, { |
| 32 | _zone: {value: null, writable: true, configurable: true}, |
| 33 | _zoneSource: {value: null, writable: true, configurable: true}, |
| 34 | _zoneSubscribe: {value: null, writable: true, configurable: true}, |
| 35 | source: { |
| 36 | configurable: true, |
| 37 | get: function (this: Observable<any>) { |
| 38 | return (this as any)._zoneSource; |
| 39 | }, |
| 40 | set: function (this: Observable<any>, source: any) { |
| 41 | (this as any)._zone = Zone.current; |
| 42 | (this as any)._zoneSource = source; |
| 43 | }, |
| 44 | }, |
| 45 | _subscribe: { |
| 46 | configurable: true, |
| 47 | get: function (this: Observable<any>) { |
| 48 | if ((this as any)._zoneSubscribe) { |
| 49 | return (this as any)._zoneSubscribe; |
| 50 | } else if (this.constructor === Observable) { |
| 51 | return _subscribe; |
| 52 | } |
| 53 | const proto = Object.getPrototypeOf(this); |
| 54 | return proto && proto._subscribe; |
| 55 | }, |
| 56 | set: function (this: Observable<any>, subscribe: any) { |
| 57 | (this as any)._zone = Zone.current; |
| 58 | if (!subscribe) { |
| 59 | (this as any)._zoneSubscribe = subscribe; |
| 60 | } else { |
| 61 | (this as any)._zoneSubscribe = function (this: ZoneSubscriberContext) { |
| 62 | if (this._zone && this._zone !== Zone.current) { |
| 63 | const tearDown = this._zone.run(subscribe, this, arguments as any); |
| 64 | if (typeof tearDown === 'function') { |
| 65 | const zone = this._zone; |
| 66 | return function (this: ZoneSubscriberContext) { |
| 67 | if (zone !== Zone.current) { |
| 68 | return zone.run(tearDown, this, arguments as any); |
| 69 | } |
| 70 | return tearDown.apply(this, arguments); |
| 71 | }; |
| 72 | } else { |
| 73 | return tearDown; |
| 74 | } |
no test coverage detected
searching dependent graphs…