Skip to content
Snippets Groups Projects
Commit f5259431 authored by Kocher, Manuel's avatar Kocher, Manuel
Browse files

Add globalThis to browsercheck, which is required by lit

parent e9ddea31
No related branches found
No related tags found
No related merge requests found
Pipeline #231827 passed
...@@ -94,6 +94,18 @@ Example usage: ...@@ -94,6 +94,18 @@ Example usage:
return true; return true;
} }
// check for globalThis support, required by lit
// https://caniuse.com/mdn-javascript_builtins_globalthis
function supportsGlobalThis() {
try {
eval('globalThis !== undefined')
} catch(e) {
return false;
}
return true;
}
function isBrowserSupported() { function isBrowserSupported() {
if (!supportsEval()) { if (!supportsEval()) {
console.log('Eval support disabled, skipping browser feature detection.'); console.log('Eval support disabled, skipping browser feature detection.');
...@@ -140,6 +152,11 @@ Example usage: ...@@ -140,6 +152,11 @@ Example usage:
return false; return false;
} }
if (!supportsGlobalThis()) {
console.log('globalThis not supported');
return false;
}
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment