const Future = require('fibers/future')
function myfunc() {
var future = new Future();
Eos().getInfo((err, res) => {
future["return"]=res;
})
return future.wait();
};
console.log(myfunc());
The Error is can't wait without a fiber please help me with this
Get rid of this with promises.
function myfunc() {
return new Promise((resolve, reject) => {
Eos().getInfo((err, res) => {
if (err) {
reject(err);
}
else {
resolve(res);
}
});
});
}
myfunc()
.then((res) => {
console.log(res);
})
.catch(err => {
console.log(err);
});