Questions tagged [asynccallback]

A callback is a piece of executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at some convenient time. An asynchronous or deferred callback is invoked after a function returns, or at least on another thread’s stack.

A callback is a piece of executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at some convenient time. An asynchronous or deferred callback is invoked after a function returns, or at least on another thread’s stack.

More Info

457 questions
0
votes
1 answer

How to pass variable from one node.js script to other

Is it possible that I pass a variable from one node.js script to other? So my childproccess can work in rhe background? I have a code: test.js var myName = "Anna"; var spawn = require('child_process').spawn; spawn('node', ['beta.js'],[myName], { …
Anna K
  • 1,666
  • 4
  • 23
  • 47
0
votes
1 answer

Understanding Callback function in NodeJS

I am very new to Node Js and Concept of Callback Mechanism , I have working code to authenticate the User based on the LDAP using ldapjs but I wanted to know the mechanism how its working with respect to data flow and callbacks. In the below code I…
Mahesh G
  • 1,226
  • 4
  • 30
  • 57
0
votes
1 answer

How to get chrome storage values via local getter setter class?

I have created a local class in a JavaScript file with following content: class CustomChromeStorage { //#region userName get userName() { let isCurrentValueSet = false; chrome.storage.sync.get('userName', function (obj) { …
0
votes
1 answer

NodeJS callback variable assignation is always one update behind

I'm learning NodeJS and I have the following code: var test = ''; function test2(name,callback) { UserData .findOne({'token': name}) .then(function(user) { test = user.token; …
Piri
  • 7
  • 1
  • 5
0
votes
1 answer

How to use JS callbacks in a recursive way?

I have this part of the code that doesn't work. It suppose to make a part of a tree view. The callback for the klassification_ajax should work after the function is done, but cause of the other ajax calls in different iteration of the while loop,…
JMJ
  • 2,034
  • 2
  • 16
  • 17
0
votes
1 answer

clarify Javascript Callback flow

I have a few different code paths with multiple callbacks. this.confirmJWT( function() { this.confirmVendorCode( function() { this.downloadFile(FORECAST); }.bind(this) ); }.bind(this) ); I'm aware that people call…
Blair Anderson
  • 19,463
  • 8
  • 77
  • 114
0
votes
1 answer

Callback not working with Angularjs?

I am new to promises and callbacks in javascript. In my project I'm trying to use getJSON to pull in info and use it in my controller. Here is what I have so far: vm.addStop = function () { vm.isBusy = false; var result; try { …
mrdcs92
  • 49
  • 1
  • 1
  • 4
0
votes
1 answer

Asynchronous callback in D3.js

I'm working on a visualization in D3 and I'm still in the learning process (JS included) and I want to remove the duplicated code from maxExportYears and maxImportYears. function calcMaximum(json) { let maxExportYears = json.map(function (obj)…
0
votes
2 answers

How to call AsyncCallback with a parameter in an BeginGetRequestStream (C#)

public void SendPost(string code) { // Create the web request object HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(Resource.Url); webRequest.Method = "POST"; webRequest.ContentType =…
DerStarkeBaer
  • 669
  • 8
  • 28
0
votes
1 answer

Javascript function returning undefined from mongodb function

Hi I get data from mongoDB and I try insert new data from other function. For some reason I get undefined. What I'm doing is wrong and how can I fix it? router.post("/list", (req, res, next) => { const params = req.body; var results_data =…
0
votes
0 answers

What is callback in JavaScript means?

hello friends I am a little bit confused in js callback function and arguments of it. Can someone to clarify this code to me(only about callback function and arguments)? Thank you in advance for your help. var allUserData = []; function…
jsDev
  • 136
  • 2
  • 12
0
votes
1 answer

Iterate function and stop depending on callback value

How do I iterate over a asynchronous function in nodejs stopping depending on callback return? Example: suppose I have following function var fn1 = function(i, callback){ // code here callfunction(i, function(err, p2){ if(err) throw…
Rogger Fernandes
  • 805
  • 4
  • 14
  • 28
0
votes
2 answers

How to create nested promises in javascript?

I am using plain javascript. I have 3 tasks to do for each element of an array. I have created promises for each element, where each one promises to do the tasks for each element. Now inside each one, I want to make 3 promises, one for each…
kkica
  • 4,034
  • 1
  • 20
  • 40
0
votes
1 answer

How call function with callback parameter?

I have this function with callback parameter Action callback: public void sync(Action callback) { var client = new RestClient(RestfulPaths.BASE_URL); var request = new…
POV
  • 11,293
  • 34
  • 107
  • 201
0
votes
2 answers

Handling multiple requests in a loop causes sync issues

I call getLogs() through a post request and get a list of LogFileID(filename) from a DB and then I pass this LogFileID to do an additional request by calling _getLogFileUrls which gives me a signed url for that ID in response. I push all of them one…
Adnan Hussein
  • 261
  • 1
  • 4
  • 14