@inlang/paraglide-js
Version:
[](https://www.npmjs.com/package/@inlang/paraglide-js) [`.
*
* @type {() => string}
*/
export let getUrlOrigin = () => {
if (serverAsyncLocalStorage) {
return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
}
else if (typeof window !== "undefined") {
return window.location.origin;
}
return "http://fallback.com";
};
/**
* Overwrite the getUrlOrigin function.
*
* Use this function in server environments to
* define how the URL origin is resolved.
*
* @param {() => string} fn - The new implementation for `getUrlOrigin()`.
*/
export let overwriteGetUrlOrigin = (fn) => {
getUrlOrigin = fn;
};
//# sourceMappingURL=get-url-origin.js.map