I’ve been having trouble with Nuxt2.15 (Vue.js). I want to send the data from parent component to child component that parent components fetched. And, I want to fetch another data from a child component by useing the data from the parent component. But props data is undefined in the child component. I tried to use “watch” and “computed” in the child
Tag: asynchronous
Property does not exist on type void
I am writing a hook to make a post request that returns two properties, sessionId and sessionData. I am using this hook in a component. My hook looks like this. And my component look like this When I try to access data.sessionData on the component I get the error that sessionDta does not exist on type void. But If I
How can I wait for a function to be called by an unknown caller?
I have a callback function that gets called by some other object which I can’t control. I need to wait until this callback function is called, I don’t care by who. I found this hacky workaround, but it sucks: Answer Create a promise, pass its resolve function as callback to the unknown caller somehow, listen to the promise’s resolution:
async and await in angular api response
I am trying to do task step by step. I have a for loop in a method: for each step must do() task. I want to wait to get response and after response coming go to next i But not work console.log print: Note time to receive response from api is not fix. Any help? Answer You can return a
Usage of asynchronous response data in asynchronous components
Below is the parent component and child component enter code here I want to draw a new chart whenever the $store(vuex) data changes. However, since the response of this data is asynchronous, when the child component is loaded, it may or may not have received the data(in Parent component). I always want to draw a chart with the data I
Calculate Value from JS Promise
I have assigned a callback function to a variable. The function then returns a promise stating it is fulfilled and the value. I want to be able to return the value and use it to perform a mathematical calculation. Javascript code: In the console I get the below output. Answer Assuming this is the interface you’re using, this is an
Conditionally load and then reference external JS
I’d like to load an external JS script based on a condition (the user’s screen width), then execute a script which references that external JS. I want to load the external JS as early as possible, so I’ve added it to the <head>, but when referencing the JS later in the <body>, it shows as undefined. I assume this is
Promise JavaScript Returning Empty Array
createFolder() function is returning an empty array. I am not sure what I am doing wrong but it needs to return the items within project_array Answer This is a classic, what you are doing is resolving the promise with the empty array before your node fs async methods have resolved. Try this instead: In essence, wrap every fs. call in
Why doesn’t .then() need the async keyword when used (similar to await)? How does Javascript know it’s an asynchronous operation?
I’m starting to learn asynchronous Javascript and I’m really confused. To be honest, the async/await approach seems very logical to me. We need to let the runtime know we’re doing an asynchronous operation so it can handle it accordingly. But why don’t we need to do the same when using the .then() method? I mean, if Javascript was already able
Axios in a firebase function returning pending promise even inside two async/await blocks
I have an async/await problems (I know, I know) that makes no sense to me. I’m declaring both functions (child and HOF) as async, and awaiting the returned results before trying to console log them. Surprise surprise, I get pending. The function hangs for 60s and times out (so it seems even my runWith timeout method isn’t working. Also tried