-
-
Save TobyEalden/e8e714ec08fc660cfbe351a1d3afede1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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