Pergunta

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!

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top