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'm reading this tutorial about Bookshelf. Bookshelf uses Bluebird promises. There's quite a few examples that look something like this:  var getEvents = function(participantId) {     return new models.Participant()     .query({where: {id:...
I'd like to use the MongoDB native JS driver with bluebird promises. How can I use Promise.promisifyAll() on this library?...
It seems generally that creating deferred objects is now commonly discouraged in favor of using the ES6-style Promise constructor. Does there exist a situation where it would be necessary (or just better somehow) to use a deferred?  For example, on...
As a node programmer. I'm used to use "nodebacks" for handling errors in my code:  myFn(param, function(err, data) {     if (err){         //error handling logic      }      else {         // business logic     } });   When writing that...
let currentProduct;  for (let i = 0; i < products.length; i++) {      currentProduct = products[i];      subscription.getAll(products[i]._id)         .then((subs) => {             update(subs, currentProduct);         }); }   I'm using blue...
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 am trying to refactory my nodejs server using promises with Bluebird library, but I am stuck in a simple problem.  After to get the users from my db, I want to list all notification class associated with this user:  Bad Way (working...)  adapter.ge...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.