Returning value from callback within Meteor.method

前端 未结 4 2081
别那么骄傲
别那么骄傲 2020-12-15 13:28

I am running into something I don\'t understand with Meteor. I have this method, which takes a query, sends it to amazon, and then in the callback of that function I try to

4条回答
  •  囚心锁ツ
    2020-12-15 14:00

    one better solution

    using Fiber package

    var Fiber = Npm.require('fibers');
    ...
    Meteor.methods({
        callAsync: function (args) {
            var fiber = Fiber.current;
    
            async(function (args) {
                ...
                fiber.run(res);
            });
    
            return Fiber.yield();
        }
    });
    

提交回复
热议问题