not enough async documentation/tests - BUG
boxxxie opened this issue · 4 comments
boxxxie commented
i'm trying to use promises with graph.add
var fs = require("q-io/fs");
var graph = new shepherd.Graph();
graph.add('config', function(){
return fs.read("config.json").then(JSON.parse);
});
var builder = graph.newBuilder()
.builds('config');
builder
.run({str: "Hello"})
.then(function(data) {
console.log(data);
});
output
{ config: { state: 'pending' } }
i'm not sure why my promises aren't working with builds()
nicks commented
what result were you expecting?
boxxxie commented
i was expecting the promise to be resolved and for config to have the value of the resolution.
i was expecting what i would get via the callback style (which works)
graph.add('cb-config', function(next){
fs.read("config.json")
.then(JSON.parse)
.then(_.partial(next,null),next);
});
nicks commented
hmmm...i see...something about the A+/promises interop isn't working correctly; we'll take a look, thanks for filing.
boxxxie commented
wow, is this resolved?