質問

Folks, How do I get the results from Y back to the Z function?

code:

module.exports = {

    Z: function (req) {
        var x = req.body
        function getX (results) {
            console.log (results)
        }
        module.exports.Y(x, getX())
    },

    Y: function (x, upstreamCallback) {
        var locals = new Array();
        async.parallel([
            function a(callback) {
            },
            function b(callback) {
            },
        ], function (err) {
           console.log(locals)
           upstreamCallback(locals)
        })
    },
}

locals are being called properly, they are showing up in the console. Problem is that locals are not being passed back to the Z...

Thanks!

役に立ちましたか?

解決

Not a NodeJS person, but my highly educated guess is that you're intending to pass getX, not call it. If you remove the parentheses, it's passed in, and should then be called in Y as upstreamCallback.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top