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

Method transform

packages/common/src/pipes/async_pipe.ts:178–200  ·  view source on GitHub ↗
(obj: Observable<T> | Subscribable<T> | PromiseLike<T> | null | undefined)

Source from the content-addressed store, hash-verified

176 transform<T>(obj: null | undefined): null;
177 transform<T>(obj: Observable<T> | Subscribable<T> | PromiseLike<T> | null | undefined): T | null;
178 transform<T>(obj: Observable<T> | Subscribable<T> | PromiseLike<T> | null | undefined): T | null {
179 if (!this._obj) {
180 if (obj) {
181 try {
182 // Only call `markForCheck` if the value is updated asynchronously.
183 // Synchronous updates _during_ subscription should not wastefully mark for check -
184 // this value is already going to be returned from the transform function.
185 this.markForCheckOnValueUpdate = false;
186 this._subscribe(obj);
187 } finally {
188 this.markForCheckOnValueUpdate = true;
189 }
190 }
191 return this._latestValue;
192 }
193
194 if (obj !== this._obj) {
195 this._dispose();
196 return this.transform(obj);
197 }
198
199 return this._latestValue;
200 }
201
202 private _subscribe(obj: Subscribable<any> | PromiseLike<any> | EventEmitter<any>): void {
203 this._obj = obj;

Callers

nothing calls this directly

Calls 2

_subscribeMethod · 0.95
_disposeMethod · 0.95

Tested by

no test coverage detected