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.

91 questions
0
votes
1 answer

Async Await with SetState... am I doing this right?

I'm trying to make the user Add a Card if it doesn't have one saved and if the user adds one, disable the button and tell it that I'll be using the saved one. The way of getting the token via tipsi-stripe is via await. Am I doing something wrong?…
0
votes
1 answer

node.js list all active threads

I am trying to teach myself about synchronous and asynchronous writing in node.js right now. Just out of interest I wanted to check all active threads while trying to write a random line into a txt.-file using fs.writeFile(). If there is any way to…
0
votes
1 answer

In D3, how to update global value by a Asynchronous function?

I defined an empty variable dataset: var dataset = []; Load data from a .csv file by d3.dsv function, the schema likes d3.dsv(",", "filename.csv", function(d){ return { key1: value, key2: value, ... }; }).then(function(d) { //do something…
0
votes
1 answer

How to wait for the internal process of a function to execute completely before returning?

I'm trying to fetch webpages using axios and cheerio but i'm failing to retrieve all the data as a function is returning even before the intennal process is completely done. I'm using ReactJS and and when i click a button in the page, this function…
0
votes
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
  • 2,890
  • 2
  • 24
  • 64
0
votes
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…
0
votes
1 answer

Unable to store result value from a tesseract function to a global variable inside an asynchronous function

I'm using tesseract JS to convert an image into text format. The conversion is successful and I'm able to print it out in the console. But I am unable to get this text outside the scope of the function. I have tried assigning the text to a global…
0
votes
1 answer

Inserts executing after transaction.commit in Knex.js

I want to execute inserts in parallel in a transaction before finishing the transaction. I used Promise.all() and bluebird promises to cancel all the promises if one failed. The problem is that the promises seem to end before the inserts are…
LeoTheDev
  • 35
  • 1
  • 4
0
votes
2 answers

Can I create my own "then()" function in Javascript and execute it?

I was going through a tutorial about Promises in Javascript. I saw usages of then() method in many places. When I wrote the below code, I saw the "then()" function under __proto__ section of the console. const myPromise = new…
user3742125
  • 557
  • 2
  • 6
  • 26
0
votes
0 answers

What Is the proper way to return a response from this promise?

I'm writing a voice-first application for the Amazon Alexa and Google Assistant platforms using the Jovo Node.js framework. I make nested http requests to an external API (the first call is to get a resource id needed as a parameter for the second…
0
votes
1 answer

Syntax Error: What's wrong with the below code

Help me resolve the below code showing syntax error. I know there is definitely some problem. How to write the below checkInventory order with the help of arrow functions. const {checkInventory} = require('./library.js'); const order =…
0
votes
1 answer

Creating div dynamically but tinyMce isn't getting loaded for the dynamically created div

My html is