模擬出版物的延遲

在現實世界中,可能會發生連線和伺服器延遲,以模擬開發環境中的延遲,可以使用 Meteor._sleepForMs(ms);

Meteor.publish('USER_DATA', function() {
    Meteor._sleepForMs(3000); // Simulate 3 seconds delay
    return Meteor.users.find({});
});