Calls to Munchkin.munchkinFunction should not be synchronous

Calls to Munchkin.munchkinFunction should not be synchronous

I've noticed some performance issues with my javascript code. After some profiling and investigations I discovered that the Munchkin javascript code hangs for a long time (200+ ms) on every call to Munchkin.munchkinFunction(). This is because the Munchkin code sends a SYNCHRONOUS XMLHttpRequest, as you can see in the following snippet taken from

a=new XMLHttpRequest;"GET",b,!1);

Moreover, many calls to 'Munchkin.munchkinFunction' are done in inside UI event handlers, for example a click on a button. Even when a timeout is provided, the sync call still needs at least 200ms to complete. These are 200ms in which the UI hangs. Even such small hangs lead to leggy CSS transitions, interrupt to implement a responsive UI, and hurt the overall user experience.

Instead of forcing all the requests to be synchronous, a better solution in my opinion will be to add a flag to the 'Munchkin.munchkinFunction' function that allows to choose between sync or async call.
Another solution may be to add a callback function, similar to what Google Analytics does:
Not applicable
Hi Tzach,

We have a beta version of munchkin out that introduces an 'asyncOnly' initialization option that will make the synchronous XHR optional. If you reach out to support we can switch your subscription to this new version as soon as next week.

The callback functionality is also in the current roadmap and is planned for release by early next year.


Community Manager
Status changed to: Under review