Questions tagged as 'promises'

1
answer

Promise not returning value

My request is returning this: data: Promise Opening Developer Tools from Chrome I see this: data: Promise __proto__:Promise [[PromiseStatus]]:"resolved" [[PromiseValue]]:"24/01/2016" Using the axios, how can you print this value? L...
asked by 06.10.2017 / 18:48
1
answer

How to call the function again without losing a promise?

I'm still new to Node.Js, and I do not know how to do this. In the code below, you'll notice that the readSubscriptions () function is called shortly after the login () function. However, if a login error occurs, I do not do anything to trea...
asked by 28.12.2016 / 21:39
1
answer

What do these mysterious double brackets mean in javascript?

Let's say I create a a in javascript: var a = new Promise(function(success, error){ { sucess("Sucesso!"); }) My variable a gets the following properties: Promise {[[PromiseStatus]]: "resolved", [[PromiseValue]]: "Sucesso!"} But no...
asked by 24.04.2016 / 00:54
1
answer

How to make a promise linked with pure Javascript? [duplicate]

How to make a dazzling call with the native Javascript promise? I mean, I would like the sentence below to be executed one after the other and that I could know when this sequence of promises are finalized. var promise; console.log...
asked by 12.06.2018 / 20:23
1
answer

Make code that uses Promises to work also in older browsers

Recently I asked this question: Wait for variable completion Moderator Sergio helped me with the issue, but I'm still having issues with compatibility with legacy browsers. Is there a way to accomplish this without using Promises and run...
asked by 12.11.2017 / 05:56
1
answer

Node js, promises, callback

I need to perform certain updates and delete within a return of a query in my controller. but only the last function is executed I do not think I understand how to use promises. api.adMaster = function (req, res) { var dados = req.bo...
asked by 01.09.2017 / 14:46
2
answers

Wait for ajax response before continuing in the loop

How could I make the following code work? On the sleep.php page I have 2 seconds of waiting for the test only. I need the next for to run only after the complete execution of the corrige function. I tried to use promises but I c...
asked by 06.09.2017 / 01:40
0
answers

Promises serve to replace the callback functions? [duplicate]

promises replace the callback functions ? Or are promises used only in asynchronous functions?     
asked by 03.07.2018 / 18:34
0
answers

How to solve or reject a (native) Javascript Promise outside your scope?

Most of the implementations I see from promises in Javascript frameworks treat the use of Promises so that it is possible to access the functions responsible for Rejection and Resolution in any scope. For example, Angular: var defer = $q();...
asked by 22.05.2018 / 17:20
2
answers

ionic - wait for return from http get

Edit: solution in the third answer. I'm trying to do a login function for a project in Ionic 2. This function checks if the user is registered in the database through the php server and returns the id of the user if he / she has a registratio...
asked by 23.05.2018 / 16:57