[clang-tools-extra] [clang-doc] add async loading (PR #93276)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 28 22:59:26 PDT 2024


================
@@ -80,8 +80,8 @@ function createIndex(Index) {
 
 // Runs after DOM loads
 document.addEventListener("DOMContentLoaded", function() {
-  // JsonIndex is a variable from another file that contains the index
-  // in JSON format
-  var Index = JSON.parse(JsonIndex);
-  createIndex(Index);
+  // LoadIndex is an asynchronous function that will be generated clang-doc
+  // it ensures that the function call will not blocked as soon the page loads
+  // since the index object are often huge and can contain thousands of lines
+  LoadIndex().then((Index) => { createIndex(Index); });
----------------
ilovepi wrote:

```suggestion
  // LoadIndex is an asynchronous function that will be generated clang-doc.
  // It ensures that the function call will not block as soon the page loads,
  // since the index object are often huge and can contain thousands of lines.
  LoadIndex().then((Index) => { createIndex(Index); });
```

https://github.com/llvm/llvm-project/pull/93276


More information about the cfe-commits mailing list