window -> global; reorg statements
This commit is contained in:
parent
a3492f8dc8
commit
25b5b9a801
|
@ -287,7 +287,7 @@ class CodeGenerator {
|
||||||
const self = this;
|
const self = this;
|
||||||
let embarkjsCode = "import EmbarkJS from 'embarkjs';";
|
let embarkjsCode = "import EmbarkJS from 'embarkjs';";
|
||||||
embarkjsCode += "\nexport default EmbarkJS;";
|
embarkjsCode += "\nexport default EmbarkJS;";
|
||||||
embarkjsCode += "\nwindow.EmbarkJS = EmbarkJS";
|
embarkjsCode += "\nglobal.EmbarkJS = EmbarkJS";
|
||||||
let code = "";
|
let code = "";
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
|
@ -365,17 +365,16 @@ class CodeGenerator {
|
||||||
function getImports(web3Location, next) {
|
function getImports(web3Location, next) {
|
||||||
web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes
|
web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes
|
||||||
code += "\nimport Web3 from '" + web3Location + "';\n";
|
code += "\nimport Web3 from '" + web3Location + "';\n";
|
||||||
|
code += "\nglobal.Web3 = Web3;\n";
|
||||||
|
|
||||||
code += "\n if (typeof web3 !== 'undefined') {";
|
code += "\n if (typeof web3 === 'undefined') {";
|
||||||
code += "\n } else {";
|
|
||||||
code += "\n var web3 = new Web3();\n";
|
code += "\n var web3 = new Web3();\n";
|
||||||
code += "\n }";
|
code += "\n }";
|
||||||
|
code += "\nglobal.web3 = web3;\n";
|
||||||
|
|
||||||
let providerCode = self.generateProvider(false);
|
let providerCode = self.generateProvider(false);
|
||||||
code += providerCode;
|
code += providerCode;
|
||||||
code += "\nglobal.__embarkContext = __mainContext.__loadManagerInstance;\n";
|
code += "\nglobal.__embarkContext = __mainContext.__loadManagerInstance;\n";
|
||||||
code += "\nwindow.Web3 = Web3;\n";
|
|
||||||
code += "\nwindow.web3 = web3;\n";
|
|
||||||
code += "\nexport default web3;\n";
|
code += "\nexport default web3;\n";
|
||||||
next(null, code);
|
next(null, code);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue