Questions tagged [asynchronous-javascript]

Asynchronous JavaScript is a technique to load JavaScript asynchronously using async and defer attributes or script tag injection. Not to be confused with AJAX.

164 questions
1
vote
4 answers

How can I call a function when another have been executed

I'm a complete beginner at JavaScript. I just want to call the function called seconONe() just after the function firstOne() completes its execution. by saying this, I mean the function two will call when the value of that p1 is 4 ( in this case );…
1
vote
1 answer

Async with recursive method

I'm trying to make a method that copies a folder tree in google drive using the drive API. I'm coming across some issues with asynchronous methods not working, if anybody can spot the flaw in the code, or point me towards some useful articles it…
jim
  • 53
  • 5
1
vote
2 answers

call Async function inside setTimeout

I am working on a project which is built using express and node js. I just need to call the async function inside the SetTimeout function (callback) Here is my Controller File module.exports.create = async (req, res) => { try { // Some DB…
1
vote
2 answers

How to write an asynchronous function

I'm doing my first ever react website and I need help to write an asynchronous JavaScript function. Here I'm uploading the user input files to a firebase storage and then making a post request to the API to store the data on the database. However,…
1
vote
1 answer

How can I execute an async function after another async function has finished executing in JS?

I am trying to create a weather report application using vanilla JS and APIs. My goals are: When web page finishes loading I want to ask user for their location. If the user accepts the request a. I want to get their coordinates using browser api…
1
vote
1 answer

Angular - Re-trigger event after event has been event.preventDefault()

I am using Angular 12 with PrimeNG in my application to implement a custom confirm() function. The use case is the following: When the user clicks on any checkbox or radio button on the form, before the event triggering, a confirmation message…
NickAth
  • 1,089
  • 1
  • 14
  • 35
1
vote
1 answer

Cant access to method and property of an array inside React useEffect

I am using Firebase, React, Redux for my project and I want to send data from firebase to redux's global store using useEffect(). The problem I am facing is that I cannot access to methods and properties of an array even though I can use…
1
vote
2 answers

Why can't I access api fetch response?

I'm new to asynchronous processes and I don't understand why my current method of trying to store a response from a fetch request to an api is not working. I'm building and Angular app, where I have a api.service.ts file where I define my fetch…
1
vote
0 answers

Readline passed a callback on.close execution order

Here I'm using the Readline module inside a function that executes a callback function on.close. It executes in the expected order (the code on.close, then the code in the callback passed to it, this can be seen with the console.log statements),…
Mick
  • 413
  • 4
  • 14
1
vote
1 answer

React Native - How to deal with asynchronism with AsyncStorage

I am facing to asynchronism problem : I create a user in firebase, generating a unique ID for it. I get this unique ID. I call an async function to persist this ID with AsyncStorage method. Problem : The asyncStorage method is called before I get…
1
vote
3 answers

Trouble fetching data with Async/Await

Hi I'm trying to fetch a country's data after which I want to fetch the names for its neighboring countries. import React from 'react'; export default function DetailsRoute({ match }) { const [countryData, setCountryData] =…
1
vote
1 answer

Call Asynchronous functions with Chai request

How to assert the values from asynchronous function while using Chai as assertion library const testData = ['PTesting', 'P2', 'P3'] describe("End to end testing.", function () { before(function () { logger.info('End to end test cases…
BTVS
  • 21
  • 4
1
vote
2 answers

React - how to set state with the data from a resolved promise

I'm struggling to get my data from a fetch request into the state of my container My fetch request is stored in api.js and looks like this - it retrieves the key from a constant which is fine:- import { openWeatherKey } from './constants'; const…
blake
  • 481
  • 4
  • 14
1
vote
1 answer

Angular filereader onloadend return result

In Angular, I have the following code which records audio, get the blob, and converts it to base64, using FileReader. But I'm not able to return this base64 data from onloadend method of file reader getRecordedAudio() { if (this.recordedAudio)…
user5155835
  • 4,392
  • 4
  • 53
  • 97
1
vote
1 answer

JavaScript asynchronous function Google Sheet API, data availability is delayed due to being a formula retrieval? How to overcome?

I'm writing a formula using Google Sheets gapi.update, and then immediately calling a function makeApiCall, attempting to retrieve the data from that cell, with gapi.get. The first iteration of this retrieval query almost inevitably returns…
1 2
3
10 11