Top "Callback" questions

A callback is a piece of code (i.e. the address or reference of a function or method or a lambda expression) that is passed as an argument to other code, which is expected to call back (execute) the argument at some convenient time.

How can I pass a parameter to a setTimeout() callback?

I have some JavaScript code that looks like: function statechangedPostQuestion() { //alert("statechangedPostQuestion"); if (xmlhttp.readyState==4) { var topicId = xmlhttp.responseText; setTimeout("…

javascript parameters callback settimeout
How to make a function wait until a callback has been called using node.js

I have a simplified function that looks like this: function(query) { myApi.exec('SomeCommand', function(response) { return response; }); } Basically i …

javascript multithreading callback node.js
How to access the correct `this` inside a callback?

I have a constructor function which registers an event handler: However, I'm not able to access the data property of …

javascript callback this
Callback functions in C++

In C++, when and how do you use a callback function? EDIT: I would like to see a simple example …

c++ callback function-pointers
JavaScript: Passing parameters to a callback function

I'm trying to pass some parameter to a function used as callback, how can I do that? function tryMe (param1, …

javascript callback parameter-passing
How to return value from an asynchronous callback function?

This question is asked many times in SO. But still I can't get stuff. I want to get some value …

javascript asynchronous callback javascript-objects
How do I create delegates in Objective-C?

I know how delegates work, and I know how I can use them. But how do I create them?

ios objective-c cocoa callback delegates
Create a custom callback in JavaScript

All I need to do is to execute a callback function when my current function execution ends. function LoadData() { alert(…

javascript callback
Callback after all asynchronous forEach callbacks are completed

As the title suggests. How do I do this? I want to call whenAllDone() after the forEach-loop has gone through …

javascript node.js asynchronous callback