6 reasons why await blows promises away

Article by Mostafa Gaafar that defines benefits of await versus promises.

This is applicable to Sciter’s script too as it supports await, but note async modifier is not required in Sciter – function that contains await statement is asynchronous by default:

const makeRequest = function() {
  const data = await getJSON()
  if (data.needsAnotherRequest) {
    const moreData = await makeAnotherRequest(data);
    return moreData;
  } else {
    return data;
  }
}

Leave a Reply