Most voted "promises" questions
An object preserves the promise that the function it generated will sometime in the future end and return you a response. It can be a positive or negative response. The Promise can be passed to other functions or returned.
Learn more…133 questions
Sort by count of
-
0
votes1
answer50
viewsJAVASCRIPT - Star Wars API -Promise Return
my problem is that I can’t return the results['name'] of the api request. When I click on the button it returns the Response.data with the following response ['Object, Object'] and when I Seto…
-
0
votes2
answers461
viewsHow to wait two promises before returning to function?
I am making a code that makes two requests, the value returned is the size of a file content-length, but I need the function that contains these two requests to return the value after the requests…
-
0
votes1
answer126
viewsPromises.all are on an infinite loop
I have the following code segment: generateEpisode(result,programId).then((arrayBlocks) =>{ const promises = [] arrayBlocks.map((file,index) =>{ promises.push(normalizeFile(file,index)) });…
-
0
votes2
answers1590
viewsPromise {status: "pending"}
buscarUsuario.onclick = function() { var usuario = document.getElementById("usuario").value; var resultado = buscaUsuario(usuario); console.log(resultado); } const buscaUsuario = async(usuario)…
-
0
votes1
answer132
viewsData synchronization, mysql and Promise
I’m a beginner in Node.js and I’m trying to understand why I can’t bring the expected result of my API. I have an application that sends an array of data to an API on Node to be saved to the…
-
0
votes1
answer1005
viewsHow to make a file return a value after 2 seconds
I have the following code: var age = parseInt(prompt('Digite sua idade: '), 10); function verificar(age){ return new Promise(function(resolve,reject){ if(age > 18){ resolve() }else{ reject() } })…
-
0
votes1
answer2802
viewsUsing Promise.resolve(). then() correctly Error: Uncaught (in Promise): Typeerror: Cannot read Property
Hi, I have the following code: export class Page { constructor(public modalController: ModalController) { } private async openModal(value) { const modal = await this.modalController.create({…
-
0
votes1
answer9533
viewsProblem with promisse, returns: "Promise {<pending>} "
Talk personal! I have a problem connecting Node.js with Spreedsheet. I use the function below to fetch the 'date' value in my spreadsheet. Until then it works very well, however, when I use "date"…
-
0
votes1
answer44
viewsPromise Node js
I make 3 HTTPS nodejs requests to an API also in Node, each Promise performs a task and these Promises I am passing several information on their body, one of these information needs to be an ID.…
-
0
votes1
answer189
viewsJavascript Promise With Runtime Error
I’m trying to solve the following exercise: Create a screen with one that should be named after a user on Github. After typing the user name and click search button. The application should search…
-
0
votes1
answer198
viewsUse variable obtained via input and declare in URL
Create a screen with one that should be named after a user on Github. After entering the user name and clicking the search button application must search for the Github API (as URL below) data from…
-
0
votes2
answers154
viewsPromise async/await not resolved
I am doing . map() in an array, to do a Mongoose/Mongodb query with each element of this array and returns another array with the results. However, after this process, I try to access the new array…
-
0
votes1
answer177
viewsHelp with API/useEffect - React
I need to make a call to the API with React and for that I’m using Axios. Doing a test with the code below, on the console I can see the result: const [bill, setBill] = useState([]); useEffect(()…
-
0
votes1
answer89
viewsHow to execute one at a time items from a sequence array using Promise - Javascript
I have an array where I want to execute each item, but one can only start after finishing the previous one. The example below is printing in sequence 2000,5000,10000 which makes me understand that…
-
0
votes1
answer24
viewsError with Promise fetch
Guys I’m doing a beginner project with API,but arrives at a part I define a function but somehow error : script.js:29 Uncaught (in promise) TypeError: Cannot read property 'querySelector' of…
-
0
votes0
answers52
viewsProblems getting data from Firebase Realtime Database
I’m learning to use Firebase and this is my first project, but when I try to put the values of the database in a variable it returns Promise { <pending> }, the code in question is: const…
-
0
votes1
answer191
viewsRun javascript function in parallel
Guys I’ve seen some questions but I did not understand well to be sure, after some researches I saw that it was possible to do this using Promises! So I took a function on Google and I modified some…
-
0
votes1
answer39
viewsDoubt about waiting for a Javascript function to return
I’m having a hard time in a situation. I am using React Native and, in a separate file, I have some global variables and I thought I would also use some functions like this: //Função "Global" que…
-
0
votes1
answer42
viewsIs it possible to use ASYNC AWAIT when receiving a PROMISE return?
I would like to know if it is possible to receive the return of a Promise using async await? I created a file where I read a file and return the string of that file, to receive this variable, in my…
-
0
votes1
answer68
viewsLoop of promises does not return JSON in Node.js
I have an array with the Events to be searched, to check if there is another one on the same day and time. The code below returns me the existing events without problem, but only on the console.log.…
javascript node.js promises async-awaitasked 4 years, 2 months ago Thiago Augusto Monteiro Pontes 3 -
0
votes0
answers106
viewsPromise.all hangs and does not resolve all languages and applications - Node.js
I’ve had a problem for a while, and I can’t figure out why. In my application I will have an array of ID’s of product categories, and from this array, for each category I want to recover all…
-
0
votes0
answers17
viewsVariable insertion problem in the Ionic Framework via HTTP methods
Good night, I am developing an App in Ionic and I want to make available a screen where it is possible for the person to view an already recorded information and can edit it as well. For example:…
-
0
votes1
answer40
viewsProblems consuming api - React
I am consuming an api that returns an array of products with Axios, but it returns a Promise, and I cannot use it in my component, because at the time the component renders, the Promise is still not…
-
-1
votes1
answer490
viewsGet fetch return with await/async
recebe(); async function recebe(){ const {url} = await pegaValores(); console.log(url); } async function pegaValores(){ return fetch('http://www.mocky.io/v2/5dba68fb3000007400028eb5')…
-
-1
votes1
answer75
viewsAsynchronous mysql queries in nodejs
Hello, I have a code in nodejs with mysql database. on one of the paths referring to the path(path) need to fetch all readings from 3 sensors (each sensor is a table) that have the path field equal…
-
-1
votes1
answer220
viewsHow to save asynchronous function return solved
To save the result of a solved asynchronous function to a variable to use the result later along the code ? Example: How do I save function result joinStrings in a variable outside the async…
-
-1
votes1
answer39
viewsCatch Return of Async Function in External File
I have 2 files in both async use / await and return a promisse. So far so good. But my question is what to call them in Controller. I’m managing to return all recipes, however, I’m not able to add…
-
-1
votes1
answer45
viewsPromise - Read Javascript File
Good Morning, I’m a beginner in Javascript I’m having difficulty using Promise to read.txt file using Fs.readFile. Detail I’m only using ". js" I did a callback all right with him but it turned into…
-
-1
votes0
answers12
viewspage keeps giving Reload every time and Fetch function is executed
const form = document.getElementById('form') form.addEventListener('submit', function (e) { e.preventDefault(); const firsName = document.getElementById('firstname') const lastName =…
-
-1
votes1
answer9
viewsHow to make Nextjs not return props before getStaticProps has completed all requests (Promises)?
Within the function getStaticProps I take some data from the database and perform in them some treatments to suit the way I will use them. Everything happens exactly as it should, except that…
-
-2
votes1
answer62
viewsHow to improve async in this case
I’m using Chromium’s standard Bluetooth API, it makes the bluetooth connection by taking its services and features so I can finally use the methods that features and everything asynchronous, ok…
-
-2
votes2
answers380
viewsThe set function of the state of the React is not actually receiving and passing on the values
I don’t know pq, but when I try to make a request for my backend, the state of "posts" does not receive the value of Answer.data. That is, the two "console.log" have different values, while…
-
-4
votes1
answer34
viewsWait for a run function to perform the next
I’m making a script in JS but I’m having a little difficulty. I wanted to make my Loop() function be called again only when my Fatown() function has already been fully executed, today when I run…