@vowel.to/client / index / NavigationAdapter
Interface: NavigationAdapter
Defined in: lib/vowel/types/types.ts:66
Navigation adapter interface for voice-controlled routing
Handles WHERE to go in your application. This adapter is responsible for navigating between pages/routes based on voice commands.
Example
ts
// Direct navigation in SPAs
const navigationAdapter = new DirectNavigationAdapter({
navigate: (path) => router.push(path),
getCurrentPath: () => router.pathname
});
// Controlled navigation for traditional sites
const navigationAdapter = new ControlledNavigationAdapter({
channelName: 'vowel-nav'
});Methods
navigate()
ts
navigate(path): Promise<void>;Defined in: lib/vowel/types/types.ts:71
Navigate to a specific path
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | The path to navigate to (e.g., "/products", "/cart") |
Returns
Promise<void>
getCurrentPath()
ts
getCurrentPath(): string;Defined in: lib/vowel/types/types.ts:77
Get the current path
Returns
string
Current path (e.g., "/products")
getRoutes()?
ts
optional getRoutes(): Promise<VowelRoute[]>;Defined in: lib/vowel/types/types.ts:83
Optional: Get available routes
Returns
Promise<VowelRoute[]>
Array of routes that can be navigated to
getContext()?
ts
optional getContext(): any;Defined in: lib/vowel/types/types.ts:88
Optional: Get additional context about the router
Returns
any