Add prettier. Format.
This commit is contained in:
34
README.md
34
README.md
@@ -48,31 +48,35 @@ An installed web app cannot access `WKWebView.allowsBackForwardNavigationGesture
|
||||
## Minimal integration
|
||||
|
||||
```ts
|
||||
import { createApp } from 'vue'
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { createNativeRouter } from '@native-vue-router/core'
|
||||
import { createApp } from "vue";
|
||||
import { createRouter, createWebHistory } from "vue-router";
|
||||
import { createNativeRouter } from "@native-vue-router/core";
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{ path: '/', component: Home },
|
||||
{ path: "/", component: Home },
|
||||
{
|
||||
path: '/chat/:id',
|
||||
path: "/chat/:id",
|
||||
component: Chat,
|
||||
meta: {
|
||||
native: { presentation: 'push', parent: '/', gesture: 'edge' },
|
||||
native: { presentation: "push", parent: "/", gesture: "edge" },
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
});
|
||||
|
||||
const nativeRouter = createNativeRouter({ router })
|
||||
createApp(App).use(router).use(nativeRouter).mount('#app')
|
||||
const nativeRouter = createNativeRouter({ router });
|
||||
createApp(App).use(router).use(nativeRouter).mount("#app");
|
||||
```
|
||||
|
||||
```vue
|
||||
<script setup lang="ts">
|
||||
import { NativeGestureLink, NativeNavigator, NativeRouterView } from '@native-vue-router/core'
|
||||
import {
|
||||
NativeGestureLink,
|
||||
NativeNavigator,
|
||||
NativeRouterView,
|
||||
} from "@native-vue-router/core";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -100,16 +104,16 @@ The Navigation Lab contains an opt-in profiler. Tap **Start profiling**, leave t
|
||||
The core API is also available directly:
|
||||
|
||||
```ts
|
||||
import { createNativeNavigationProfiler } from '@native-vue-router/core'
|
||||
import { createNativeNavigationProfiler } from "@native-vue-router/core";
|
||||
|
||||
const profiler = createNativeNavigationProfiler(nativeRouter, {
|
||||
metadata: { build: import.meta.env.VITE_BUILD_ID },
|
||||
})
|
||||
});
|
||||
|
||||
profiler.start()
|
||||
profiler.start();
|
||||
// Reproduce the navigation issue.
|
||||
const report = profiler.stop()
|
||||
const json = profiler.toJSON(report)
|
||||
const report = profiler.stop();
|
||||
const json = profiler.toJSON(report);
|
||||
```
|
||||
|
||||
No rAF loop or browser performance observer runs before `start()`, and `stop()` removes them. Reports contain frame intervals, refresh-rate estimates, per-navigation timing, cold-mount preparation, route loading, cache eviction, visibility changes, and browser-supported Long Task/layout-shift/resource timing. Route params, query values, and application state are omitted.
|
||||
|
||||
Reference in New Issue
Block a user