MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / readNavState

Function readNavState

core/src/components/router/utils/dom.ts:66–83  ·  view source on GitHub ↗
(root: HTMLElement | undefined)

Source from the content-addressed store, hash-verified

64 * The function returns a list of RouteID corresponding to each of the outlet and the last outlet without a RouteID.
65 */
66export const readNavState = async (root: HTMLElement | undefined) => {
67 const ids: RouteID[] = [];
68 let outlet: NavOutletElement | undefined;
69 let node: HTMLElement | undefined = root;
70
71 // eslint-disable-next-line no-cond-assign
72 while ((outlet = searchNavNode(node))) {
73 const id = await outlet.getRouteId();
74 if (id) {
75 node = id.element;
76 id.element = undefined;
77 ids.push(id);
78 } else {
79 break;
80 }
81 }
82 return { ids, outlet };
83};
84
85/** Max animation frames `scrollToFragment` polls while waiting for the target to mount. */
86const FRAGMENT_POLL_FRAMES = 30;

Callers 1

navChangedMethod · 0.90

Calls 3

searchNavNodeFunction · 0.85
getRouteIdMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected