MCPcopy Create free account
hub / github.com/angular/angular / getTransferState

Function getTransferState

packages/core/src/render3/util/transfer_state_utils.ts:24–40  ·  view source on GitHub ↗
(injector: Injector)

Source from the content-addressed store, hash-verified

22 * @returns The transfer state data as an object, or empty object if not available
23 */
24export function getTransferState(injector: Injector): Record<string, unknown> {
25 const doc = injector.get(DOCUMENT);
26 const appId = injector.get(APP_ID);
27
28 const transferState = retrieveTransferredState(doc, appId);
29
30 // Strip internal keys. Keys are taken verbatim from the serialized state, so they can name
31 // `Object.prototype` properties like `__proto__`; a dictionary keeps them as ordinary entries.
32 const filteredEntries = createDictionary<unknown>();
33 for (const [key, value] of Object.entries(transferState)) {
34 if (!isInternalHydrationTransferStateKey(key)) {
35 filteredEntries[key] = value;
36 }
37 }
38
39 return filteredEntries;
40}

Callers 2

Calls 5

retrieveTransferredStateFunction · 0.90
createDictionaryFunction · 0.90
getMethod · 0.65
entriesMethod · 0.45

Tested by

no test coverage detected