106
rated 0 times
[
111]
[
5]
/ answers: 1 / hits: 156093
/ 8 Years ago, sun, may 8, 2016, 12:00:00
When using a simple callback such as in the example below:
test() {
api.on( 'someEvent', function( response ) {
return response;
});
}
How can the function be changed to use async / await? Specifically, assuming 'someEvent' is guaranteed to be called once and only once, I'd like the function test to be an async function which does not return until the callback is executed such as:
async test() {
return await api.on( 'someEvent' );
}
More From » asynchronous