I have below code
async function callme(){
methods.callfun(x)
.then(function (res) {
methods.callfunxx(res)
.on("send", function (r) {
console.log(r);
})
.on("error", function (error, r) {
console.error(error);
});
});
}
And I want to call like this
const rr = await callme();
but its not waiting to so I am trying to change this in await and tried below
async function callme(){
const res = await methods.callfun(x);
const response = await methods.callfunxx(res)
response.on('send',() => {
return (`Successfully`)
});
response.on('error',() => {
return (`error`)
});
}
Till second await its waiting.. but rest is not working as expected... I am trying to return response as per send/error.
Any help
Thanks