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: