duizendnegen / ember-cli-lazy-load

Support lazily loading your Ember app via splitting it up into Bundles
MIT License
42 stars 8 forks source link

Avoid synchronous XMLHttpRequest #1

Open B-Stefan opened 8 years ago

B-Stefan commented 8 years ago

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.

MiguelMadero commented 8 years ago

@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).

duizendnegen commented 8 years ago

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

MiguelMadero commented 8 years ago

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.