I am new to javascript, I need some help understanding how promises(using bluebird) should be used. Below is my code and I want the constructor to initialize a property after property is resolved.
var getCookie = function(object, someParams) {
   return connect(someParams)
   .then(function(response){
      self.cookie = response.cookie;//this should be done as part of object initialization.
      done();
    });
}
var app = function(){
  var self = this;
  getCookie(self);
  //how to make sure that return happens after promise is resolved?
  return self;
}
 
    