Questions tagged as 'callback'

3
answers

Multiple callbacks with JavaScript

Hello everyone. I have two distinct function callbacks that give me values that need to be used outside of these functions. Here is the code: FB.api('/me', function(response) { FB.api('/me/picture?type=normal', function(response) {...
asked by 03.08.2015 / 23:57
2
answers

Enable button when the last request is executed successfully

I have a table with multiple records with their respective information and ids . When I click on a button I make a request via post and Ajax individually from that row of the table. But I have another button that scrolls the ent...
asked by 08.01.2018 / 03:25
2
answers

How to assign the callback variable "cursor.toArray (err, doc)" to an external variable?

var result = []; var user = db.collection('user'); var cursor = user.find(); cursor.toArray(function (err, doc) { result = doc; }); console.log(result); // console -> []     
asked by 10.12.2017 / 16:31
1
answer

Call more than one callback at a time

I need a WorkerClass that generates sequential numbers to print through a Callback Interface these numbers in the MainActivity and in a SegundaActivity when opened. My problem is that when SegundaActivity is open the MainActivity no longer recei...
asked by 31.01.2018 / 00:00
2
answers

Retrieve callback return

I have the function below that calculates distances using a Google API. I would like to know how to get the callback function returned. <script type="text/javascript" src="_global/_js/jquery-2.1.4.min.js"></script> <script s...
asked by 16.10.2016 / 20:11
1
answer

How to wait for the Javascript callback

I have a problem, I know because of how javascript works, but I do not know how to work around it. I'm using Cordova and a feature needs to use Phone permission on Android. So before running the method I check if the permission was granted...
asked by 17.03.2017 / 17:02
1
answer

How to make a function run after another? JS (Jquery)

I have the following functions: Gets server data by ajax and saves it to an Array of objects: function carregaPesquisaTabela(){ controlLoading(); $.ajax({ url: "header.php", type: "POST", dataType:"json", data: { 'procuraPes...
asked by 03.11.2018 / 00:25
0
answers

When using async do not need to use callback?

I have the following function in nodeJs v10.6: #func-1 module.exports.funcOne = (event, context, callback) => { callback(null, { message: 'funcOne', event }); }; #func-2 module.exports.funcTwo = async (event, context) => { console...
asked by 03.08.2018 / 21:27
1
answer

Callback as argument return

My question is as follows, so I understand callbacks are functions passed as a parameter that will be executed when any statement is performed, but I often see callback as reserved word to return parameters to a function, such as i...
asked by 08.01.2018 / 18:59
1
answer

Javascript - It is possible to have a universal sort function

I have an object called report and I have a report vector and need to do several sorts, so I thought I would do a sorting function that was "universal". I wanted to be able to pass the attribute to be sorted, so that I could reuse the sort funct...
asked by 20.11.2017 / 04:55