How to use the @here/harp-utils.getUrlOrigin 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-mapview / lib / workers / WorkerLoader.ts View on Github external
return this.startWorkerImmediately(scriptUrl, timeout).catch(error => {
            if (typeof window !== "undefined") {
                const pageUrl = window.location.href;
                const fullScriptUrl = new URL(scriptUrl, pageUrl).href;
                if (getUrlOrigin(fullScriptUrl) === getUrlOrigin(pageUrl)) {
                    throw error;
                }
                logger.log(
                    "#startWorker: cross-origin worker construction failed, trying load with blob"
                );
                this.directlyFallbackToBlobBasedLoading = true;
                return WorkerLoader.startWorkerBlob(scriptUrl, timeout);
            } else {
                throw error;
            }
        });
    }