async-await Questions
2
Solved
I would like to be able to create a #Preview that uses some values that are computed with async/await.
Below is a sample code with the first 2 previews working fine. The last one calling an async f...
Chlorous asked 21/10, 2023 at 12:58
4
Solved
I'd like to do something like this in mounted() {}:
await fetchData1();
await fetchData2UsingData1();
doSomethingUsingData1And2();
So I wonder if this works:
async mounted() {
await fetchData1...
Remscheid asked 28/11, 2018 at 6:38
4
I have a call I am making from inside a xaml-based, C# metro application on the Win8 CP; this call simply hits a web service and returns JSON data.
HttpMessageHandler handler = new HttpClientHandl...
Demoss asked 27/3, 2012 at 18:3
17
Solved
I have a project where I'm trying to populate some data in a constructor:
public class ViewModel
{
public ObservableCollection<TData> Data { get; set; }
async public ViewModel()
{
Data ...
Monadism asked 16/11, 2011 at 1:19
15
Solved
Summary: I would like to call an asynchronous method in a constructor. Is this possible?
Details: I have a method called getwritings() that parses JSON data. Everything works fine if I just call g...
Confluence asked 13/4, 2014 at 20:49
5
Solved
So, task.Wait() can be transformed to await task. The semantics are different, of course, but this is roughly how I would go about transforming a blocking code with Waits to an asynchronous code wi...
Yablon asked 2/9, 2014 at 21:35
2
Solved
Let's say I have a function like below that could fail. The function is also async
async fn can_fail() -> Result<i32, Box<dyn std::error::Error>> {
let mut rng = rand::thread_rng();...
Bedplate asked 22/2, 2023 at 13:49
12
Solved
Background
I am trying to filter an array of objects. Before I filter, I need to convert them to some format, and this operation is asynchronous.
const convert = () => new Promise( resolve =...
Hardfavored asked 3/11, 2017 at 11:45
4
Solved
I am trying to get my head around the async/await keywords and usage, and I think I got the basics. But something isn't working right in my SQLite code.
I am using the SQLite.core NuGet package in...
Divisionism asked 27/12, 2015 at 6:20
10
Solved
I'm using Express.js in my code with Node.js v7.3. In this I've created a User Router which forwards the requests to my User Controller.
I'm using async/await inside the User Controller to do asyn...
Grados asked 22/12, 2016 at 8:38
2
Solved
On ASP.NET Core I'm observing a strange behavior, that was actually reported in BackgroundService not shutting down, stoppingToken never set with .net core generic host but without the root cause e...
Balustrade asked 29/8, 2022 at 19:58
3
I have the following code in Swift 5.5 and iOS 15
func getReviewIds() {
var reviewIds: [Int] = []
Task {
let ids = await getReviewIdsFromGoogle()
reviewIds.append(contentsOf: ids)
}
pri...
Andryc asked 16/6, 2021 at 4:22
3
Solved
Here's one way to detect if the current engine supports async functions:
const supportsAsyncFunctions = (() => {
try {
new Function('async () => {}')();
} catch (error) {
return false;
...
Advertise asked 19/4, 2017 at 17:32
2
I want to do something like this
const { Readable } = require("stream");
function generatorToStream(generator) {
return new Readable({
read() {
(async () => {
for await (const result of ge...
Clothesbasket asked 25/2, 2019 at 13:33
2
Solved
In Javascript certain operators are processed before others:
1 + 2 * 3
// 1 + (2 * 3)
// 7 because * has higher precedence than +
1 === 0 + 1
// 1 === (0 + 1)
// true because + has a higher preced...
Seasoning asked 12/1, 2018 at 2:31
8
I am using the async/await function the following way
async function(){
let output = await string.replace(regex, async (match)=>{
let data = await someFunction(match)
console.log(data); //gi...
Revolver asked 10/11, 2015 at 13:23
2
Solved
I want to create a simple websocket server. I want to process the incoming messages and send a response, but I get an error:
error: captured variable cannot escape `FnMut` closure body
--> src\...
Latinist asked 24/6, 2020 at 14:18
2
Solved
I'm trying to set up email confirmation for an ASP.NET MVC5 website, based on the example AccountController from the VS2013 project template. I've implemented the IIdentityMessageService using Smtp...
Gwyn asked 4/2, 2015 at 23:13
13
Solved
Is there any harm in using async/await and .then().catch() together such as:
async apiCall(params) {
var results = await this.anotherCall()
.then(results => {
//do any results transformation...
Annabelannabela asked 6/3, 2019 at 9:27
2
Solved
I have an interface that requires me to return Task<T>, but there is nothing awaitable called, hence it I could return Task.FromResult(instanceofT), like in following simple situation:
...
Piane asked 13/12, 2023 at 14:49
3
Solved
I'm trying to run an "async" method from an ordinary method:
public string Prop
{
get { return _prop; }
set
{
_prop = value;
RaisePropertyChanged();
}
}
private async Task<string> Get...
Amberjack asked 30/11, 2013 at 18:51
3
Is it possible to await till Angular EventEmitter emits, like it's possible to await ajax call (Angular 5 synchronous HTTP call)?
What I want to do is:
Having a Child component
@Component({
tem...
Peony asked 7/6, 2020 at 19:16
7
Solved
I'm having a problem where I cannot await an asynchronous function inside of the FormClosing event which will determine whether the form close should continue. I have created a simple example that ...
Ammamaria asked 20/5, 2013 at 19:3
3
I'm trying to understand node.js single threaded architecture and the eventloop to make our application more efficient. So consider this scenario where I have to make several database calls for an ...
Brisling asked 12/7, 2020 at 15:3
5
Solved
I used quote marks around "right way" because I'm already well aware that the right way to use an asynchronous API is to simply let the asynchronous behavior propagate throughout the entire call ch...
Gokey asked 28/11, 2018 at 22:29
© 2022 - 2024 — McMap. All rights reserved.