Category "async-await"

How do I implement an async Drop in Rust?

I have an async fn that returns a type, and want to implement Drop on that type that calls another async function. It's not clear how to do this, and I can't fi

How to use Promise.prototype.finally() in async/await syntax?

Actually my main question was using Promise.prototype.catch() in async/await ES8 syntax, Undoubtedly Promise.prototype.then() is existed in essence of async/awa

How to correctly structure a nested node-fetch request to avoid Promise<pending>?

I'm attempting to Fetch GET my website (with node-fetch) Scrape it with Cheerio to get specific posts Fetch GET from my CMS (with node-fetch) to check if there'

What does the suspend function mean in a Kotlin Coroutine?

I'm reading Kotlin Coroutine and know that it is based on suspend function. But what does suspend mean? Coroutine or function gets suspended? From https://kotli

await & async when you don't care about errors

Let's take a simple example, fs.stat. I can promisify fs.stat and write: const stats = await stat(file, fs.constants.R_OK); but if the file doesn't exist this

Difference betweeen Two line of same code

can someone explain to me the differenec between the two line of code. In my atom editor the prettier changes the first to second. (await fetchSearchResults(sta

Best Practice winforms async/await keywords

Testing a bit TPL. I use this code and it works: async void button1_Click(object sender, EventArgs e) { MyClass2 mc2 = new MyClass2(); la

The return type of an async function must be the global Promise<T> type

Why does TSlint still says "The return type of an async function or method must be the global Promise type"? I can't understand what's wrong. UPDATED:

Using chrome.tabs.executeScript to execute an async function

I have a function I want to execute in the page using chrome.tabs.executeScript, running from a browser action popup. The permissions are set up correctly and i

What are asynchronous functions in JavaScript? What is "async" and "await" in JavaScript?

This Q&A is aimed to give clear answers to the following questions: What are asynchronous functions in JavaScript and when and how do we use them? What are

How to solve async-await function problem while using Axios?

I want to use axios using async await function. But when I use async await function then I get an error. useEffect(async() => { await axios .get("

Wrap a call in a task, to add a timeout?

We have an SDK that we are using from a 3rd-party. We have no access or insight into the code at all, or ability to change anything with it. We're running into

Is .GetAwaiter().GetResult(); safe for general use?

I read in a few places that .GetAwaiter().GetResult(); could cause deadlocks and that we should use async/await instead. But I see many code samples where this

How to hydrate a Dictionary with the results of async calls?

Suppose I have code that looks like this: public async Task<string> DoSomethingReturnString(int n) { ... } int[] numbers = new int[] { 1, 2 , 3}; Suppo

How would I monitor and restart tasks that throw exceptions in C#?

Let's say I have a program that instantiates three tasks that run indefinitely. These tasks are intended to run in parallel. However, lets say these tasks are k

Asynchronous property setter

Let us suppose we have a class with a property that can only be set asynchronously. Is there a way to make this work without explicitly calling a setter? MNWE:

Best way to use multiple awaits C# .NET Blazor

In a Blazor app I have a file uploader that can take multiple files. When the user clicked 'upload' I used something like this: private async Task HandleFileUpl

Get rid of uncaught errors when resolving a promise

I have the following method export abstract class BaseCalculator { /** * Compute the promise parameter. * @param name name of the parameter. * @param

Combination of async function + await + setTimeout

I am trying to use the new async features and I hope solving my problem will help others in the future. This is my code which is working: async function asyn

Fetch data from firestore inside a stream map

Is it possible to let a stream await during a fetch from firestore? I want to achieve that a user also fetches his own roles from the firestore database. Of cou