Questions tagged as 'promises'

0
answers

how to return value of the FetchAPI request inside a variable?

I need to return a value of a request made with Javascript FetchAPI for a variable, I made that attempt but without success: function listeItens(tipo_item) { var itens; fetch('ajax/html/liste_itens.asp?tipo_item='+tipo_item...
asked by 06.06.2018 / 17:28
0
answers

How to understand the data flow of a Promise in ES6?

I was studying the working of Promise in ES6 and came across a pseudo-code of implementing a simple Promise: class PromiseSimple { constructor(executionFunction) { this.promiseChain = []; this.onResolve = this.onResolve...
asked by 21.05.2018 / 19:33
1
answer

Assign the return of a function that returns from a promisse

I am exporting a function to another file that is as a webpack-simple + vuejs component, This is the function of api-user.js file: export function getUsers () { axios.post('/api/get_list',{}) .then(req => {return req.data.list;})...
asked by 18.03.2018 / 17:14
0
answers

How to return an object from within the then of a Promise in Angular 4

I have a simple question about Promise. Would anyone know how to proceed? I want to return an object from within the then. I'll give you an example ... buscarUsuario(id): Usuario { return this.userService(id) .then( user => { //QUE...
asked by 24.02.2018 / 22:23
0
answers

I can not execute a query within a socket event using node.js (socket.io), why?

Here's what I did initially: var http = require('http'), express = require('express'), mysql = require('promise-mysql'), mysql2 = require('mysql'), parser = require('body-parser'), path = require("path"...
asked by 04.02.2018 / 19:17
1
answer

Check if Node created with insertAdjacentHTML in a loop is "visible"

I'm looking for fragments of HTML with fetch() and adding to DOM with function insertAdjacentHTML() in loop for() ... the function that performs this task is in Promise() and its% return (in case of succ...
asked by 28.01.2018 / 18:51
1
answer

How to send this variable "dt" to the promise.done?

I have the following line of javascript: ... var refundVal = $( ".refundVal" ).val(); var dt={ orderId:orderId, refundVal:refundVal, process:btnProcess }; window.srObjc.confirm("message $"+refundVal+" ?").p...
asked by 15.08.2017 / 22:09
1
answer

How to ensure that a function that depends on ngOnInit runs after it?

I have a class that when initialized retrieves data from a service and popular one of its attributes, which is an array . This class has a function that sorts this array , filters and returns the result. When instantiating an object of this...
asked by 06.02.2017 / 19:15
1
answer

How to finalize a loading screen after executing promisses in the Angular?

Good morning. I have a question, I have a controller that searches for some data from a webservice rest, and persists them in the database of the device (ionic), to search the data, I'm using 'promises'.   When you start the search I open a...
asked by 07.06.2016 / 16:25
1
answer

return value of a promise in javascript

Well I'm facing the following problem, I'm contributing in a mozilla extension but most of the browser apis use promises to do things, but the problem is that I do not master much. Well I'd really like to know how to return the value of a promis...
asked by 07.05.2018 / 04:22