MCPcopy Index your code
hub / github.com/angular/angular / patchSubscription

Function patchSubscription

packages/zone.js/lib/rxjs/rxjs.ts:117–151  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115 });
116
117 const patchSubscription = function () {
118 ObjectDefineProperties(Subscription.prototype, {
119 _zone: {value: null, writable: true, configurable: true},
120 _zoneUnsubscribe: {value: null, writable: true, configurable: true},
121 _unsubscribe: {
122 get: function (this: Subscription) {
123 if ((this as any)._zoneUnsubscribe || (this as any)._zoneUnsubscribeCleared) {
124 return (this as any)._zoneUnsubscribe;
125 }
126 const proto = Object.getPrototypeOf(this);
127 return proto && proto._unsubscribe;
128 },
129 set: function (this: Subscription, unsubscribe: any) {
130 (this as any)._zone = Zone.current;
131 if (!unsubscribe) {
132 (this as any)._zoneUnsubscribe = unsubscribe;
133 // In some operator such as `retryWhen`, the _unsubscribe
134 // method will be set to null, so we need to set another flag
135 // to tell that we should return null instead of finding
136 // in the prototype chain.
137 (this as any)._zoneUnsubscribeCleared = true;
138 } else {
139 (this as any)._zoneUnsubscribeCleared = false;
140 (this as any)._zoneUnsubscribe = function () {
141 if (this._zone && this._zone !== Zone.current) {
142 return this._zone.run(unsubscribe, this, arguments);
143 } else {
144 return unsubscribe.apply(this, arguments);
145 }
146 };
147 }
148 },
149 },
150 });
151 };
152
153 const patchSubscriber = function () {
154 const next = Subscriber.prototype.next;

Callers 1

patchRxJsFunction · 0.85

Calls 2

runMethod · 0.65
applyMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…