Category "async-await"

How to call async function in sync code and break async/await chain (i.e. how to wrap an async function in a sync function)

All my code is written without asyncio in mind; however, I use one function that is async (written by another developer; for my purposes it's a black box). Let'

Return not waiting for if condition

any one can help me.. I am developing a small project in Electron js. as a beginner I could not find any solution for this issue. I have search a lot similar pr

What is the order of execution/control flow of "await" in javascript?

I have this piece of code and I'm struggling to understand why the log order is "1,3,2". (async () => { const doSomething = async () => { cons

Swift Playground with async/await "cannot find 'async' in scope"

I'm trying to run this async function on Xcode Playground: import Foundation import PlaygroundSupport PlaygroundPage.current.needsIndefiniteExecution = true e

'async' call in a function that does not support concurrency swift ios Xcode async/await

I'm trying to use async/await with Swift 5.5. I have my async function, but whenever I try to call it, I get this error: 'async' call in a function that does

What thread runs the code after the `await` keyword?

Let me just post a simple example: private void MyMethod() { Task task = MyAsyncMethod(); task.Wait(); } private async Task My

Why does an async function finishes executing after a promise started later?

This is something about the event loop I don't understand. Here's the code: async function async1() { console.log('async1 start'); await async2(); con

Handling Promise rejection with catch while using await

I am using await to make the code cleaner, but I am not sure whether I am handling exceptions correctly. An example while using azure-devops-node-api; const foo

Vue 3 dynamically loaded component hooks not called

I have this (shorten for the question) single file component (vue 3.2.31): <template lang="pug"> .test Hello world! </template> <style lang="sass

Why does this swift async-await code fails with leaked continuation?

I am experimenting with Swift async-await and AsyncSequence protocol, Here is the code: struct AsyncNumbers<Element: Numeric>: AsyncSequence { private

Using `await` in AuthorizationHandler

I have a AuthorizationHandler depending on a Service offering async methods for .NET Core 3.1's Authorization Middleware. I have o call some of these async meth

Task Runner in Javascript

I have a list of tasks and all these tasks need to be executed only after all the dependencies are resolved for each task. I am struggling to figure out a way t

Async/Await in useEffect(): how to get useState() value?

I have the following code snippet. Why is my limit always 0 in my fetchData? If I were to console.log(limit) outside of this function it has the correct number.

async / await for Node.js https.get

I'm trying to simplify code with async / await But have problems making https.get with async / await structure. I am aware of how to do this with third-party mo

How would I run a while loop on a separate thread in Python?

I'm new to coroutines in python but I know in lua you would do this to create one coroutine.wrap(function() while true do end end)() But I dont know how I wo

Proper syntax of parameters using function run_in_executor()

To make a POST call to the API, I use the following script: r = requests.post( url, headers={ "Content-Type": "application/json" }, json

is it possible to await for a promise response using setInterval?

Basically i have an timer, lets say the timer starts at 60 seconds and goes to 0 when it reaches 0 it makes an api call and the timer restarts, the issue im hav

This is the case for List in my StatefulWidget

Flutter import 'package:country_house/pages/Country.dart'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; class AllCountries extends St

Discord Python bot - Coroutine never awaited

I'm trying to make a Blind-test bot game in Python, which actually works pretty fine. I managed to get a whole spotify playlist in the queue with that play_next

Flutter - how to trigger a function after the async function is completed

Hi I would like for the addUserToFirestore() function to trigger after the code above has done being executed Future<void> registerAccount( String e