I have the following ES6 class and need to wait for the getAppearances function to return before the program flow continues, i.e. synchronously - how do I do this?
class MyClass {
constructor() {
}
getAppearances(id) {
return MyColl.find({
...
}).fetch();
}
}
export { MyClass as default};
const c = new MyClass;
if( c.getAppearances > 0 ){
....
}
else{
...
}
//turn async function into synchronous
asyncFunc = function (callback) {
//async stuff here
MyColl().find('stuff', function () {
callback();
});
}
syncFunc = Meteor.wrapAsync(asyncFunc);
syncFunc();