ember-cli-lazy-load icon indicating copy to clipboard operation
ember-cli-lazy-load copied to clipboard

Avoid synchronous XMLHttpRequest

Open B-Stefan opened this issue 9 years ago • 3 comments

Currently we using the Ember.$.ajax in sync mode and this cause the warning "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/."

The reason for this is that we need to load the file and wait for the file to be processed by the javascript engine. Otherwise it can happen that the Ember.$.ajax callback get called while the browser is still processing the module definitions.

B-Stefan avatar Jan 15 '16 09:01 B-Stefan

@B-Stefan are you sure that the callback can called before the script is executed? I'm doing something similar and didn't have any issues. I'm pretty sure the script execution is blocking, which is another big issue that I would like to tackle separately (e.g. one thing is to lazily download to pre-load something, but still lazily evaluate to avoid blocking).

MiguelMadero avatar Mar 23 '16 19:03 MiguelMadero

I'll try and confirm, but so far we've seen this behavior unfortunately yea.

duizendnegen avatar Mar 23 '16 21:03 duizendnegen

Oh, that's bad, I guess that's something that I've not hit on my approach yet. Likely due to the size of the packages. Immediately after the script is "loaded" I go and look for a module defined in that script. That would result in a required exception if that's not loaded. I'll try that again with a larger package.

MiguelMadero avatar Mar 24 '16 00:03 MiguelMadero