Commit 58a71ed8 authored by Aniket-Engg's avatar Aniket-Engg

separate function added

parent df3d4932
...@@ -320,7 +320,7 @@ class CompilerContainer { ...@@ -320,7 +320,7 @@ class CompilerContainer {
url = `${this.data.baseurl}/${this.data.selectedVersion}` url = `${this.data.baseurl}/${this.data.selectedVersion}`
} }
// Check if browser is compatible with web worker // Check if browser is compatible with web worker
if (document.location.protocol !== 'file:' && Worker !== undefined) { if (this.browserSupportWorker) {
// Workers cannot load js on "file:"-URLs and we get a // Workers cannot load js on "file:"-URLs and we get a
// "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium, // "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium,
// resort to non-worker version in that case. // resort to non-worker version in that case.
...@@ -374,6 +374,10 @@ class CompilerContainer { ...@@ -374,6 +374,10 @@ class CompilerContainer {
this.data.compileTimeout = window.setTimeout(() => this.compileIfAutoCompileOn(), this.data.timeout) this.data.compileTimeout = window.setTimeout(() => this.compileIfAutoCompileOn(), this.data.timeout)
} }
browserSupportWorker () {
return document.location.protocol !== 'file:' && Worker !== undefined
}
} }
module.exports = CompilerContainer module.exports = CompilerContainer
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment