promise async await callback 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));
});
}