JS newbie here so perhaps I don't even realize how to word this question properly, my apologies.
A 3rd party function by default uses callback to make an HTTP request and return a value. Below is simplified sample from the doc:
someObj.someFunc(params, function(err, data) {
console.log(data); // successful response
});
The problem: async approach doesn't work here because I need data
before I can continue. I try to convert in to non-async version (the library allows it):
GetData = someObj.someFunc(params);
ret = GetData.send()
console.debug(ret);
It is ok so far: I'm getting the response:
data
is null here but from this answer I know it is ok, and if I expand the Object
(without reloading page or anything like that) I see the necessary value:
Now the problem is: I cannot get data
value!
console.debug(ret.data); // returns null
I tried to debug with JSON.stringify()
but ret
is cyclic object. I tried this solution to dump the cyclic object but the answer shows no data
.
How should it be done? How can I get the data.ShardIterator
value?