(root: HTMLElement | undefined)
| 64 | * The function returns a list of RouteID corresponding to each of the outlet and the last outlet without a RouteID. |
| 65 | */ |
| 66 | export 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. */ |
| 86 | const FRAGMENT_POLL_FRAMES = 30; |
no test coverage detected