Commit c04ecdc4 by Alexander Gusev

fix env to work in electron correctly

The problem is: electron env includes and browser and nodejs together. Therefore, both isBrowser and isNodejs function will return true. The comment in the code mentions, that isBrowser is explictly called first to prevent electron renderer process to be initialized with wrong environment due to isNodejs() returning true. But current code (before the change) executes both isBrowser and isNodejs blocks. This commit resolves the issue.
parent 8609b25a
...@@ -22,10 +22,10 @@ function initialize() { ...@@ -22,10 +22,10 @@ function initialize() {
// check for isBrowser() first to prevent electron renderer process // check for isBrowser() first to prevent electron renderer process
// to be initialized with wrong environment due to isNodejs() returning true // to be initialized with wrong environment due to isNodejs() returning true
if (isBrowser()) { if (isBrowser()) {
setEnv(createBrowserEnv()) return setEnv(createBrowserEnv())
} }
if (isNodejs()) { if (isNodejs()) {
setEnv(createNodejsEnv()) return setEnv(createNodejsEnv())
} }
} }
......
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