website: redesign part 34

This commit is contained in:
nym21
2026-06-22 16:42:14 +02:00
parent b3031b3375
commit 17478a4ac4
57 changed files with 1630 additions and 799 deletions
+9
View File
@@ -1497,6 +1497,12 @@ const _openBrowserCache = (option) => {
return caches.open(name).catch(() => null);
};
/**
* @param {string} url
* @returns {URL}
*/
const _parseBaseUrl = (url) => new URL(url, typeof location === 'undefined' ? undefined : location.href);
/**
* Custom error class for BRK client errors
*/
@@ -1849,6 +1855,9 @@ class BrkClientBase {
const isString = typeof options === 'string';
const rawUrl = isString ? options : options.baseUrl;
this.baseUrl = rawUrl.endsWith('/') ? rawUrl.slice(0, -1) : rawUrl;
const url = _parseBaseUrl(this.baseUrl);
this.url = url.href.endsWith('/') ? url.href.slice(0, -1) : url.href;
this.domain = url.hostname;
this.timeout = isString ? 5000 : (options.timeout ?? 5000);
/** @type {Promise<Cache | null>} */
this._browserCachePromise = _openBrowserCache(isString ? undefined : options.browserCache);