window -> global; reorg statements

This commit is contained in:
Michael Bradley, Jr 2018-07-19 20:45:17 -05:00
parent 454fd1214c
commit 3fb4d86e67
1 changed files with 4 additions and 5 deletions

View File

@ -287,7 +287,7 @@ class CodeGenerator {
const self = this;
let embarkjsCode = "import EmbarkJS from 'embarkjs';";
embarkjsCode += "\nexport default EmbarkJS;";
embarkjsCode += "\nwindow.EmbarkJS = EmbarkJS";
embarkjsCode += "\nglobal.EmbarkJS = EmbarkJS";
let code = "";
async.waterfall([
@ -365,17 +365,16 @@ class CodeGenerator {
function getImports(web3Location, next) {
web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes
code += "\nimport Web3 from '" + web3Location + "';\n";
code += "\nglobal.Web3 = Web3;\n";
code += "\n if (typeof web3 !== 'undefined') {";
code += "\n } else {";
code += "\n if (typeof web3 === 'undefined') {";
code += "\n var web3 = new Web3();\n";
code += "\n }";
code += "\nglobal.web3 = web3;\n";
let providerCode = self.generateProvider(false);
code += providerCode;
code += "\nglobal.__embarkContext = __mainContext.__loadManagerInstance;\n";
code += "\nwindow.Web3 = Web3;\n";
code += "\nwindow.web3 = web3;\n";
code += "\nexport default web3;\n";
next(null, code);
}