EvolvedWeb / evowc

Evolved Web Components
MIT License
8 stars 0 forks source link

callbacks for `router.onChange` should be passed the current path #62

Closed intervalia closed 7 months ago

intervalia commented 11 months ago

Is your feature request related to a problem? Please describe. Currently, any callback for router.onUpdate is not passed any parameters.

Describe the solution you'd like To help reduce the code that a developer needs to write we need to pass either window.location or window.location.pathname to the callback.

intervalia commented 7 months ago

Included in the next release. This will pass the following:

{
  pathname: window.location.pathname,
  search: window.location.search,
  query: parseQueryParams(window.location.search),
  hash: windows.location.hash.slice(1)
}

parseQueryParams converts the query string into an object.