()
| 153 | // Resolves once the data router has completed its initial load (mirrors |
| 154 | // vue-router `router.isReady()`). |
| 155 | export function isAppRouterReady(): Promise<void> { |
| 156 | if (!appRouter || appRouter.state?.initialized !== false) { |
| 157 | return Promise.resolve(); |
| 158 | } |
| 159 | return new Promise((resolve) => { |
| 160 | const unsubscribe = appRouter?.subscribe?.((state) => { |
| 161 | if (state.initialized) { |
| 162 | unsubscribe?.(); |
| 163 | resolve(); |
| 164 | } |
| 165 | }); |
| 166 | if (!unsubscribe) resolve(); |
| 167 | }); |
| 168 | } |