From 3fb4d86e673b9a9307eb0dd864764ce04fe11ba9 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Thu, 19 Jul 2018 20:45:17 -0500 Subject: [PATCH] window -> global; reorg statements --- lib/contracts/code_generator.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/contracts/code_generator.js b/lib/contracts/code_generator.js index af91b6dda..9cae038c4 100644 --- a/lib/contracts/code_generator.js +++ b/lib/contracts/code_generator.js @@ -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); }