how to await for a callback from ajax javascript code example
Example: await callback
function apiOn(event) {
return new Promise(resolve => {
api.on(event, response => resolve(response));
});
}
function apiOn(event) {
return new Promise(resolve => {
api.on(event, response => resolve(response));
});
}