I have a constructor function which registers an event handler:    function MyConstructor(data, transport) {     this.data = data;     transport.on('data', function () {         alert(this.data);     }); }  // Mock transport object var tran...
I've been developing JavaScript for a few years and I don't understand the fuss about promises at all.  It seems like all I do is change:  api(function(result){     api2(function(result2){         api3(function(result3){              // do...
I have a function callWithMagic which takes a callback function as a parameter and calls it with one argument.  const callWithMagic = callback => {   const magic = getMagic();   callback(magic); };   I also have a function processMagic which tak...
I want to know when an image has finished loading. Is there a way to do it with a callback?  If not, is there a way to do it at all?...
As the title suggests. How do I do this?   I want to call whenAllDone() after the forEach-loop has gone through each element and done some asynchronous processing.  [1, 2, 3].forEach(   function(item, index, array, done) {      asyncFunction(item,...
I am getting the "object" value instead of the exact value. How do I get the value returned using a callback function?  function loadDB(option, callBack){     var dfd = new jQuery.Deferred(),         db = window.openDatabase('mydb',...
I'm currently writing JavaScript and confusing about callback. I've found it's not kind of built-in functions though... I'm now reading O'Relly JavaScript 5th Edition and it shows a sample code something like below:  getText = f...
Can someone give a clear definition together with a simple example that explains what is a "callback hell" for someone who does not know JavaScript and node.js ?  When (in what kind of settings) does the "callback hell problem" occu...
I'm new to ajax and callback functions, please forgive me if i get the concepts all wrong.  Problem: Could i send a callbackfunction as a parameter to another function that will execute the callback?  function firstFunction(){     //some code...
Is just a function that executes after one other function that calls it, finishes?  Please I know (almost) nothing about programming, and I find it quite hard to find a proper newbie answer or explanation about what does this means.  Can I request...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.