/prmsf

Primary LanguageJavaScript

prmsf

npm install prmsf --save
var p = require('prmsf');
function connect() {
  return p.wrap((cb) => MongoClient.connect('mongodb://localhost:27017/mydb', cb));
}
function connect() {
  return p.call(MongoClient.connect.bind(MongoClient), 'mongodb://localhost:27017/mydb');
}
var mongoConnect = p.bind(MongoClient.connect, MongoClient);

function connect() {
  return mongoConnect('mongodb://localhost:27017/mydb');
}
var deferred = p.defer();

setTimeout(function(){ deferred.resolve(123); }, 1000);

deferred.promise.then(function(result){
  console.log(result);
});