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
0
votes
1 answer

NodeJS - rl.on() - read multiple numbers in multiple lines

EDIT : Thanks for the answers. I got the solution to achieve below with Promises. If this can be done without it in a simpler way please answer :) I need to take standard input like below 3 60 120 30 100 25 30 10 Variable form for above n W v1…
0
votes
2 answers

Angular 9 typescript how to make a function with a for loop to finish first before proceeding to the next function?

I'm currently learning more about the asynchronous aspect of angular and typescript so forgive me if my knowledge is lacking, I am currently facing a problem where I'm trying to implement promises to make a function which contains a for loop finish…
0
votes
1 answer

Can't use promises & async wait in AWS Lambda node.js working with docClient & Firehose

I am unable to understand how to reliably use async in node.js when working with firehose and dynamoDB functions. For example: async function dynamoDBToCSV(record) { ... try { const res = await…
monkey
  • 1,213
  • 2
  • 13
  • 35
0
votes
1 answer

async function is not waiting at await

I need to scroll down before doing some action. my promise function is not waiting in await line. how can I solve this problem? let scrollingPromise = new Promise(async (resolve, reject) => { // I need this part to be done before resolving …
0
votes
1 answer

How to handle Asynchronous JavaScript code inside a while loop?

I was trying to fetch data from an API using $.getJSON(), but I ran into a problem. Maximum results per call which I can get is 50. However nextPageToken is provided by the api to get data from another page. In the while loop (below code) I want to…
0
votes
1 answer

html loads a new page before the jquery finishes the execution

I want to change the value of variable in jquery when the anchor html tag with link is clicked , this tag also loads new page but when I click on that anchor tag new page is loaded but the variable value is not changed. I looked on the internet and…
Tushar Sureka
  • 111
  • 1
  • 1
  • 9
0
votes
0 answers

How to handle callbacks?

I have a function which is -: function generateAndEmitSessionizedEvents(workflowIdVsClientId, workflowIdVsEvents, clientVsIdVsDoc, esWriteFailedWorkflowIds) { return _generateSessionizedEvents(workflowIdVsClientId, workflowIdVsEvents,…
0
votes
0 answers

Stepping into an async function

I'm trying to fetch data from an API, and encountered an issue. The function fetchCountryData doesn't help debug the issue because any breakpoints inside it are ignored. How do I step into an async function? const [countryData, setCountryData] =…
0
votes
2 answers

How to wait for the whole recursion to finish before moving on in Javascript?

I am new to reactJS and am trying to build a sorting visualizer. The problem I am facing is while implementing the quickSort() routine. My quickSort() routine is as follows: async quickSort(array, p, r) { if(p
JANVI SHARMA
  • 115
  • 1
  • 11
0
votes
1 answer

Self monitoring of mongodb with nodejs

I want to get serverstatus data from mongodb on nodejs for all my users(of their respective databases). I have to do this repeatedly unless user makes x field false. N when he turns it true again I will have to start fetching data again. I thought…
0
votes
0 answers

returned object by callback has no method in itself to run

i wrote a code which send a get request by jquery-ajax,also i use a call back to return the result of this request.But the returned value has no applicable method in itself(when i press alt+space i have nothing in that menu).the question is why? any…
0
votes
0 answers

async methods for running parallel jobs

I am working in a program that has below steps: fetch user data from Database(it has more than 2000 users get list of roles for all users( each user might have roles) send mail to those users which has more roles Running them synchronously will…
0
votes
0 answers

React Native Geolocation: Why is this async function returning undefined?

I have the following function: func = async () => { let location = await getLocation(); console.log(location) } it calls this function getLocation = async () => { Geolocation.getCurrentPosition( (position) => { …
0
votes
1 answer

Are there only some spefiic callbacks that are processed inside the event loopin Nodejs after the call stack is empty?

1.const geoCode = (address, callback)=> { setTimeout(()=> { const data ={ longitude: 0, latitude: 0 } callback(data) }) } geoCode('John', (data)=>{ console.log(data) }) 2. const forecast =(longitude, latitude, callback) =>{ …
0
votes
1 answer

How to use await/async properly in Nodejs Azure Function App

I am trying to write a code to connect with snowflake inside the azure function app using nodejs stack. Here is the code I have writtern. async function af2snf() { console.log("starting connection"); var snowflake = require('snowflake-sdk'); //…