Skip to content

Instantly share code, notes, and snippets.

@TobyEalden
Forked from iendjinn/Bluebird.js
Last active February 17, 2017 12:44
Show Gist options
  • Save TobyEalden/e8e714ec08fc660cfbe351a1d3afede1 to your computer and use it in GitHub Desktop.
Save TobyEalden/e8e714ec08fc660cfbe351a1d3afede1 to your computer and use it in GitHub Desktop.
// estimator.js
module.exports = (function() {
var getData = function(id, cb) {
return api.getDataAsync(id, this.state.filter);
}
function estimator(initial) {
this.state = initial;
this.getData = getData;
}
return estimator;
}());
// Databot.js
var Promise = require("bluebird");
var Estimator = require("./estimator.js");
var estimator = new Estimator(initial);
estimator.getData(id)
.then((data) => {
console.log(data);
}).catch((err) => {
console.log(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment