Ultimate access to all questions.
How should you design a single-page web application where the UI communicates with a third-party API via XMLHttpRequest, ensuring that non-critical API data doesn't block UI rendering, while maintaining good performance during API errors or timeouts?
Explanation:
The key requirements are that API calls should not delay UI rendering and it's acceptable to omit the API data on errors.
asynchronous: false
), which block the UI thread, delaying rendering. This violates the requirement to avoid delaying other parts of the UI.asynchronous: true
), allowing non-blocking UI rendering. Omitting the widget on errors aligns with the requirement to tolerate missing API data.Thus, B is the correct choice as it satisfies both non-blocking UI and graceful handling of API failures.