Add new APIs
This adds the $.path
, $.search
, $.loc
, $.relocate
, $.tz
and $.lang
APIs.
To add the geolocation APIs, geolocation is captured when MicroRender handles the initial request. This is copied between client-side requests, though it can be updated using $.relocate()
, which does nothing on the server-side (geolocation hasn't changed since the start of the request) but on the client-side GETs /_locate/
to update geolocation data.
$.lang
returns the user's preferred languages as an array, parsed from the Accept-Language
HTTP header. It follows the same rules as the geolocation APIs for updates.
$.path()
is shorthand for $.url().pathname
. $.search
is an easier way to get query parameters, and follows the same API as $.form
.