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