You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/esroute/README.md
+48-1Lines changed: 48 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ Those features may be the ones you are looking for.
18
18
-[🏎 Fast startup and runtime](#-fast-startup-and-runtime)
19
19
-[🛡 Route guards](#-route-guards)
20
20
-[🦄 Virtual routes](#-virtual-routes)
21
+
-[⏱️ Deferred rendering](#-deferred-rendering-1)
21
22
22
23
### 🌈 Framework agnostic
23
24
@@ -38,6 +39,20 @@ router.go((prev) => ({
38
39
}));
39
40
```
40
41
42
+
#### Wrapped history navigation API
43
+
44
+
The `go` method is a wrapper around the history navigation API.
45
+
You can use it to navigate to a specific history state:
46
+
47
+
```ts
48
+
awaitrouter.go(1); // Go one step forward and wait for the popstate event to be dispatched
49
+
awaitrouter.go(-2); // Go two steps back and wait for the popstate event to be dispatched
50
+
```
51
+
52
+
A difference is that the `go` method will not render the page, if the `skipRender` flag is set.
53
+
54
+
Additionally, `go` is asynchronous, and in case of history navigation, it will wait for the popstate event to be dispatched.
55
+
41
56
### 🕹 Simple configuration
42
57
43
58
A configuration can look as simple as this:
@@ -95,7 +110,7 @@ esroute comes with no dependencies and is quite small.
95
110
96
111
The route resolution is done by traversing the route spec that is used to configure the app routes (no preprocessing required). The algorithm is based on simple string comparisons (no regex matching).
97
112
98
-
####🛡 Route guards
113
+
### 🛡 Route guards
99
114
100
115
You can prevent resolving routes by redirecting to another route within a guard:
0 commit comments