How can I fix the slow website speed caused by deprecated APIs?

So recently i ran in to a problem where by some reason my website is working so slow doe to this error. Can anybody help me fix this, it is ruining the site speed so bad. my error on google site speed test:

Deprecated APIs will eventually be removed from the browser. Learn more about deprecated APIs.

Deprecation / WarningSource


masterysneakers.com
1st Party

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help, check https://xhr.spec.whatwg.org/.

…assets/shop_events_listener-a7c63db….js:1:7166

Hello Tomeliss,

This warning from browser telling you that using synchronous XMLHttpRequest on the main thread is deprecated because it can have negative effects on the user experience.

Synchronous XMLHttpRequest halts the execution of the JavaScript code until the request is complete. This could lead to a frozen user interface and a poor user experience, especially if the requested resource is slow to respond or unavailable. That’s why it’s recommended to use asynchronous XMLHttpRequest instead.

Here’s how you can make an asynchronous XMLHttpRequest:

var xhr = new XMLHttpRequest();
xhr.open(“GET”, “https://api.example.com/data”, true); // true makes it asynchronous

If you find my suggestion difficult to implement send an email at rajvee.kadchha@mlveda.com

Could you instruct me where should i implement this piece of code?

In your code, you will be able to find this section. Please refer to the screenshot, you just have to add the highlighted code.

May i know in which file is it?