Meteor wrapAsync'u nasıl kullanırım? AşağıdaMeteor wrapAsync sözdizimi
ben synchronosly bu iki Meteor.call
fonksiyonları çalıştırmak istiyorum ama sadece bir nesne döndürmesi shuold console.log(getGroup);
üzerinde undefined
olsun
if (tempTreatment.groupId === undefined) {
// create new group
Meteor.wrapAsync(Meteor.call('createTreatmentGroup', salon, tempTreatment.groupName, tempTreatment.groupName));
// get group id
var getGroup = Meteor.wrapAsync(Meteor.call('getTreatmentGroup', salon, tempTreatment.groupName));
console.log(getGroup);
tempTreatment.groupId = getGroup._id;
}
yapmaya çalışıyorum budur.
0.9.3'te, "Her Yerde" kullanılabilen [Meteor.wrapAsync] (http://docs.meteor.com/#meteor_wrapasync) var. Bu hata mı? –
Bunu fark etmemiştim. "Meteor.wrapAsync" in bir istemci sürümü oluşturduklarını düşünüyorum, böylece kodun kullanılması hata tetiklemeden paylaşılan klasöre yerleştirilebilirdi, ancak bu gerçekten sunucu kullanımı için tasarlandı. Geri arama yapılmadığı takdirde, wrapAsync'in istemci tarafındaki sürümü, sadece kullanılacak standart bir "logErr" geri çağrısını tanımlar; bu, eğer varsa, hatayı basitçe kaydeder: https://github.com/meteor/meteor/blob/ 9608e6205019b69a302cde62e21fcae1c7d22e3d/paketler/göktaşı/helpers.js # L108 – saimeunt