Category "async-await"

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

How to return a result from an async task?

I would like to return a string result from an async task. System.Threading.Tasks.Task.Run(async () => await audatex.UploadInvoice(assessment, fileName));

Async.eachOfSeries not looping

I tried aysnc.eachOfSeries but the code does not loop. It stops executing in the first iteration itself and freezes. I guess I made some error in returning the

How to wait for a JavaScript Promise to resolve before resuming function?

I'm doing some unit testing. The test framework loads a page into an iFrame and then runs assertions against that page. Before each test begins, I create a Pro

XCTest: Wait for async call to finish in synchronous function

I have a synchronous function that calls an asynchronous sub function. Now I want to test that the synchronous function sets a property. I've seen many examples

Running WebAssembly on Google Apps Script

I am attempting to run WebAssembly on the new V8 Google Apps Script runtime, and it appears to be supported, however it seems that async functions are terminate

Parallelizing multiple long-running tasks with async/await

I have a helper method returns IEnumerable<string>. As the collection grows, it's slowing down dramatically. My current approach is to do essentially the

@MainActor is not safely when it used with propertyWrapper?

Combined use @mainActor and propertyWrapper is not safe? The code will execute directly in the background thread. It is a bug? Here is the demo: struct DetailVi

How to trigger (NOT avoid!) an HttpClient deadlock

There are a number of questions on SO about how to avoid deadlocks in async code (for example, HttpClient methods) being called from sync code, like this. I'm a

Limited parallelism with async/await in Typescript/ES7

I've been experimenting a bit with Typescript, but I'm now a bit stuck on how to use async/await effectively. I'm inserting a bunch of records into a database,