14 juin 2016

Meteor 1.3 - Simulate latency on publications

Snippet revamped for Meteor 1.3 and based on : Meteor Simulate high latency publish function


import { Meteor } from 'meteor/meteor';
import Future from 'fibers/future';
import Todo from '../Todo';

Meteor.publish('todo.public', function() {
  const future = new Future();
  Meteor.setTimeout(() => future.return(Todo.find()), 5000);
  return future.wait();
});