8

I don't want to ever hear that you're proficient in JavaScript if you put a callback function call inside of an async function right after using the await command.

All you manage to do in the end was make a simple function that gets data to populate a dropdown menu into something that is absolutely more awful to look at than the worst callback hell possible.

Refactoring this code base has really questioned my sanity and how much I'm willing to spend on alcohol.

Comments
  • 1
    setTimeout(function(){

    // Do a thing after await.
    callback();

    }, 1);

    😎
  • 1
    @HiFiWiFiSciFi I should mention that the method is called in Vue's next tick function, the callback is defined there.

    Within the definition of the callback it also populates ANOTHER drop down with data that doesn't care about the data we are waiting to get from the server. In fact the data for that second dropdown can just be defined in the data method for the Vue file.
  • 0
    Call me maybe)
  • 0
    @HiFiWiFiSciFi or using setTimeOut instead of await to "make sure" the async function has been called
Add Comment