Category "async-await"

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

How can I use async/await at the top level?

I have been going over async/await and after going over several articles, I decided to test things myself. However, I can't seem to wrap my head around why this

The asyncio.sleep is "waking up" too early

I am writing a telegram bot, which has to work for numerous users simultaneously. The bot has to send messages at random time during a certain time frame. When

how can i implement JWT token in my website? [closed]

I implemented JWT Token Authentication in React framework, It gets me token but the problem I am getting is I am not able to authenticate it o

What's the VB.NET equivalent of async delegate in C#?

I'm trying to convert the following extension method (source) from C# to VB: public static Task ForEachAsync<T>(this IEnumerable<T> source,

How to insert API response into HTML

I used pure function to create wrapper for multiple HTML elements and don't understand how to insert JSON response API data into it. Can you help to create one

async/await always returns promise

I'm trying async/await functionality. I have such code imitating a request: const getJSON = async () => { const request = () => new Promise((resolve, r

Use async await with Array.map

Given the following code: var arr = [1,2,3,4,5]; var results: number[] = await arr.map(async (item): Promise<number> => { await callAsynchron

If async-await doesn't create any additional threads, then how does it make applications responsive?

Time and time again, I see it said that using async-await doesn't create any additional threads. That doesn't make sense because the only ways that a computer c

Do you have to put Task.Run in a method to make it async?

I'm trying to understand async await in the simplest form. I want to create a very simple method that adds two numbers for the sake of this example, granted, i