- Listen for
load
event - Listen for
hashchange
event - Listen for
popstate
event - Listen for manual pushState event
- Intercept all link clicks
- Extract URL info
- Compare and run internal URL update if needed
- Extract URL info
- Compare and run internal URL update if needed
- Extract the latest hash from URL
- Compare and run internal URL update with before route change handler if needed
- Extract URL info
- Compare and run internal URL update with before route change handler if needed
- Check if the link should be intercepted
- Continue to 3. for intercept-able link
- Extract URL info from link's href
- Compare and run internal URL update with before route change handler if needed
- When
skipCheck=false
, compare the old and new route to determine if route change is needed. - Continue to 3. for a new route
- Continue to 4. for a matched route, else run http-404 handler.
- Find matched route then fire manual pushState event with the route matched keys
- Compare old and new route to determine if route change is needed
- Find before route change handler for the current route and continue to 3. if found one. Else, skip to 4.
- Execute before route change handler and wait for route change approval. Continue to 4. for an approved route change.
- Run internal URL update with
skipCheck=true
.
- Fire manual pushState event with
notFound=true
to notify a not-found route
- Find matched route
- If matched route, fire URL change event with matched groups
- Else, run 404 route handler for a not-found route