in embarkJS, if no arguments are passed default to []

This commit is contained in:
Iuri Matias 2016-10-23 12:08:29 -04:00
parent 3ea6e53218
commit fd984b0e6c
2 changed files with 6 additions and 75 deletions

View File

@ -76,7 +76,7 @@ var EmbarkJS =
var self = this;
var contractParams;
contractParams = args;
contractParams = args || [];
contractParams.push({
from: this.web3.eth.accounts[0],
@ -5907,83 +5907,14 @@ var EmbarkJS =
/***/ function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
(function () {
try {
cachedSetTimeout = setTimeout;
} catch (e) {
cachedSetTimeout = function () {
throw new Error('setTimeout is not defined');
}
}
try {
cachedClearTimeout = clearTimeout;
} catch (e) {
cachedClearTimeout = function () {
throw new Error('clearTimeout is not defined');
}
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
@ -5999,7 +5930,7 @@ var EmbarkJS =
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
var timeout = setTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
@ -6016,7 +5947,7 @@ var EmbarkJS =
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
clearTimeout(timeout);
}
process.nextTick = function (fun) {
@ -6028,7 +5959,7 @@ var EmbarkJS =
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
setTimeout(drainQueue, 0);
}
};

View File

@ -29,7 +29,7 @@ EmbarkJS.Contract.prototype.deploy = function(args) {
var self = this;
var contractParams;
contractParams = args;
contractParams = args || [];
contractParams.push({
from: this.web3.eth.accounts[0],