Skip to main content

CotomyUrl

Utility wrapper around the current URL.

Constructor

  • new CotomyUrl(url?: string | null) Creates a URL wrapper (defaults to the current location).

Static Methods

MethodDescription
location()Returns a wrapper for the current location.

Properties

PropertyTypeDescription
urlstringPath + query string.
pathstringPathname only.
segmentsstring[]Path segments.
querystringRaw query string (without ?).
parametersRecord<string, string>Query parameters as an object.

Methods

MethodDescription
redirect()Navigates to the current url.
replace()Replaces the current history entry.
replaceState(state?, title?)Calls history.replaceState.