How to use the @here/harp-utils.baseUrl function in @here/harp-utils

To help you get started, we’ve selected a few @here/harp-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heremaps / harp.gl / @here / harp.gl / lib / BundleMain.ts View on Github external
export function resolveBundledResourceUrl(url: string) {
    if (url.startsWith(HARP_GL_BUNDLED_ASSETS_PREFIX)) {
        const bundleSriptUrl = getBundleScriptUrl();
        if (bundleSriptUrl === null || bundleSriptUrl === undefined) {
            throw new Error(
                `harp.js: cannot resolve ${url} because 'harp.gl' base url is not set.`
            );
        } else {
            url = url.substring(HARP_GL_BUNDLED_ASSETS_PREFIX.length);
            if (url.startsWith("/")) {
                url = url.substring(1);
            }
            return baseUrl(bundleSriptUrl) + url;
        }
    }
    return url;
}