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...
Consider the following code that reads an array of files in a serial/sequential manner. readFiles returns a promise, which is resolved only once all files have been read in sequence.  var readFile = function(file) {   ... // Returns a promise. };...
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 component which gets a collection of items as props and maps them to a collection of components which are rendered as children of a parent component. We use images stored in WebSQL as byte arrays. Within the map function I get an image Id...
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...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.