I was writing code that does something that looks like:  function getStuffDone(param) {           | function getStuffDone(param) {     var d = Q.defer(); /* or $q.defer */ |     return new Promise(function(resolve, reject) {     // or = new $.Defer...
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 am having a hard time running promises sequentially.  var getDelayedString = function(string) {     var deferred = Q.defer();      setTimeout(function() {         document.write(string+" ");         deferred.resolve();     }, 500);      r...
This question already has answers here:...
In my code, based on a specific condition, I would like to skip to the done function, irrespective of all the then functions.  The original version of this question is in the edits. The following is the actual problem I am dealing with. Sorry for t...
I have a simple node module which connects to a database and has several functions to receive data, for example this function:    dbConnection.js:  import mysql from 'mysql';  const connection = mysql.createConnection({   host: 'localhost...
I would like to call the Google Maps Geocoding API using a Promise like this:  function makeGeoCodingRequest(address,bounds) {     /*         Input parameters:             address:a string             bounds: an object of class google.maps.LatLngBoun...
In, for example, kriskowal's Q, one can do something like:  promise1.then(function(p1){   var p2 = makePromise2();   var p3 = makePromise3();   var p4 = makePromise4();   return [p2, p3, p4]; }) .all(promises, function(){   console.log('all p...
As part of a small program I'm writing, I would like to use gulp to convert a large set of a files to markdown. This is not part of a build step separate from the program. It's a part of the program. So I'm not using a gulpfile to handle...
I'm using the Q promise library. My code relies on the fact that the callbacks for a single promise are executed in the same order as they were registered.  http://jsfiddle.net/HgYtK/1/  var deferred = Q.defer(); var promise = deferred.promise;...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.