Javascript Meteor wrapAsync未在客户端上返回值
我正在尝试使用Meteor.wrapAsync使用Slingshot上载文件,然后获取上载URL。我已经创建了这个函数,但在运行它时,image_url最终没有定义。但图像确实成功上载 获取图像urlJavascript Meteor wrapAsync未在客户端上返回值,javascript,node.js,asynchronous,meteor,Javascript,Node.js,Asynchronous,Meteor,我正在尝试使用Meteor.wrapAsync使用Slingshot上载文件,然后获取上载URL。我已经创建了这个函数,但在运行它时,image_url最终没有定义。但图像确实成功上载 获取图像url var uploadSlingshotFileSync = Meteor.wrapAsync(uploadSlingshotFile); image_url = uploadSlingshotFileSync(image_file); console.log(image_url); 功能 upl
var uploadSlingshotFileSync = Meteor.wrapAsync(uploadSlingshotFile);
image_url = uploadSlingshotFileSync(image_file);
console.log(image_url);
功能
uploadSlingshotFile = function(file, callback) {
var uploader = new Slingshot.Upload("photoUploads");
uploader.send(file, function (error, uploadURL) {
callback(null, uploadURL);
});
};
wrapAsync的语法有什么遗漏吗?wrapAsync使函数只在服务器上同步,因为客户端上没有光纤。哦,好的。你对我怎么做有什么建议吗?