Skip to content

Interface: LocationLike

API / @xmachines/play-sveltekit-router / LocationLike

Defined in: play-router/src/types.ts:432

The minimal location interface of an adapter that reads the current URL at the moment of connect(). You can inject it for SSR and for a test: give a mock in place of the global location when no DOM is available.

The definition is structural, and it holds no reference to Location. This package therefore compiles without the DOM lib.

Example

// SSR or a test — an injected mock
const mockLoc: LocationLike = { pathname: "/dashboard", search: "?tab=posts" };
connectRouter({ actor, routeMap, location: mockLoc });

Properties

PropertyModifierTypeDefined in
pathnamereadonlystringplay-router/src/types.ts:433
searchreadonlystringplay-router/src/types.ts:434