Now it returns the value directly (or throws an error). Perfect for server-side methods!
let result = Meteor.wrapAsync((cb) => { setTimeout(() => cb(null, 'Done'), 1000); })();
If you're still using Meteor.wrapAsync , you're writing legacy code (but it works!). Here's the modern take:
If you're working with asynchronous code in Meteor (especially on the server), you've likely encountered Meteor.wrapAsync .
// Modern Meteor 3 approach async function fetchData() { return new Promise((resolve) => { setTimeout(() => resolve({ user: 'alice' }), 100); }); } const result = await fetchData(); Use wrapAsync for legacy callback-based npm packages, but prefer Promises + async/await in new code.