[New Package] Simulate network lag and actual UX while keeping your code clean


On the dev machine, simple method calls are almost instantaneous.

This is great, unless you are creating some UX feature that shows the user that something is being done in the background, such as animation or a temporary UI state (by making the method behave differently on the client).
In that case, the user experience on the development machine is significantly different from the one experienced by the end-user.

In order to fix this, I used to add call Meteor._sleepForMs() right in my method code. This solution, while it worked, was dirty and I could not commit and push it to production.

Therefore, I created a simple devOnly package (alon:lag-methods) that wraps the method calls and delays them.
You can set a default delay and configure custom delays for individual methods.

I also wrote a Constellation front-end (alon:lag-console) for it, so that it can be easily configured.

Your feedback can help me figure out if this package is useful and how I can make it more helpful.

I received a feature request for doing something similar with publications. What do you think?

Any comments regarding the concept, execution and documentation are welcome.

Here are some teasers for illustration:


Well, it went under the knife and now it looks like this:

The UI still needs a bit of work, but the functionality is pretty much there.

This version is not yet released, and I am interested in resolving some issues before announcing or releasing.
It is now possible to delay publications as well, although there is a certain issue with unblocking publications during login/logout.

I am using @arunoda’s meteorhacks:unblock package, and in those scenarios it provides a dummy unblock method instead of the real deal. I have a coarse solution for this, but If anyone knows an elegant technique to unblock publications, I would appreciate any input.