diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-22 03:43:20 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-22 03:43:20 +0800 |
commit | ceb4357a8d66e5112369293b15247f03c561c514 (patch) | |
tree | 915e03281096df16c8d351574409fc98fd62aafe /lib/web3.js | |
parent | fc986a3fbee02a4fcfbd4e74d9881fc25d5538b4 (diff) | |
download | go-tangerine-ceb4357a8d66e5112369293b15247f03c561c514.tar go-tangerine-ceb4357a8d66e5112369293b15247f03c561c514.tar.gz go-tangerine-ceb4357a8d66e5112369293b15247f03c561c514.tar.bz2 go-tangerine-ceb4357a8d66e5112369293b15247f03c561c514.tar.lz go-tangerine-ceb4357a8d66e5112369293b15247f03c561c514.tar.xz go-tangerine-ceb4357a8d66e5112369293b15247f03c561c514.tar.zst go-tangerine-ceb4357a8d66e5112369293b15247f03c561c514.zip |
sync api tests running, removed unused pieces of code
Diffstat (limited to 'lib/web3.js')
-rw-r--r-- | lib/web3.js | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/lib/web3.js b/lib/web3.js index 58bcc0c3f..166bf68de 100644 --- a/lib/web3.js +++ b/lib/web3.js @@ -23,48 +23,6 @@ * @date 2014 */ -/// Recursively resolves all promises in given object and replaces the resolved values with promises -/// @param any object/array/promise/anything else.. -/// @returns (resolves) object with replaced promises with their result -function flattenPromise (obj) { - if (obj instanceof Promise) { - return Promise.resolve(obj); - } - - if (obj instanceof Array) { - return new Promise(function (resolve) { - var promises = obj.map(function (o) { - return flattenPromise(o); - }); - - return Promise.all(promises).then(function (res) { - for (var i = 0; i < obj.length; i++) { - obj[i] = res[i]; - } - resolve(obj); - }); - }); - } - - if (obj instanceof Object) { - return new Promise(function (resolve) { - var keys = Object.keys(obj); - var promises = keys.map(function (key) { - return flattenPromise(obj[key]); - }); - - return Promise.all(promises).then(function (res) { - for (var i = 0; i < keys.length; i++) { - obj[keys[i]] = res[i]; - } - resolve(obj); - }); - }); - } - - return Promise.resolve(obj); -} - /// @returns an array of objects describing web3 api methods var web3Methods = function () { return [ @@ -179,22 +137,6 @@ var setupMethods = function (obj, methods) { result = JSON.parse(result); return result.result; - //return flattenPromise(Array.prototype.slice.call(arguments)).then(function (args) { - //var call = typeof method.call === "function" ? method.call(args) : method.call; - //return {call: call, args: args}; - //}).then(function (request) { - //return new Promise(function (resolve, reject) { - //web3.provider.send(request, function (err, result) { - //if (!err) { - //resolve(result); - //return; - //} - //reject(err); - //}); - //}); - //}).catch(function(err) { - //console.error(err); - //}); }; }); }; @@ -212,16 +154,6 @@ var setupProperties = function (obj, properties) { result = JSON.parse(result); return result.result; - - //return new Promise(function(resolve, reject) { - //web3.provider.send({call: property.getter}, function(err, result) { - //if (!err) { - //resolve(result); - //return; - //} - //reject(err); - //}); - //}); }; if (property.setter) { proto.set = function (val) { @@ -233,19 +165,6 @@ var setupProperties = function (obj, properties) { result = JSON.parse(result); return result.result; - //return flattenPromise([val]).then(function (args) { - //return new Promise(function (resolve) { - //web3.provider.send({call: property.setter, args: args}, function (err, result) { - //if (!err) { - //resolve(result); - //return; - //} - //reject(err); - //}); - //}); - //}).catch(function (err) { - //console.error(err); - //}); }; } Object.defineProperty(obj, property.name, proto); |