Open B-Stefan opened 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).
I'll try and confirm, but so far we've seen this behavior unfortunately yea.
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.
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.