Skip to content

Commit d2bc56d

Browse files
committed
Fixed The doSearch refrence error Race condition
1 parent 3e0d7b9 commit d2bc56d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

index.html

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,20 @@
109109
}
110110
</script>
111111
<script type="text/javascript">
112-
$(document).ready(function() {
113-
doSearch();
114-
});
112+
document.addEventListener("DOMContentLoaded", () => {
113+
const script = document.createElement("script");
114+
script.src = "js/activity.js";
115+
script.onload = () => {
116+
if (typeof Activity !== "undefined") {
117+
const activityInstance = new Activity();
118+
if (typeof activityInstance.doSearch === "function") {
119+
activityInstance.doSearch();
120+
}
121+
}
122+
};
123+
document.body.appendChild(script);
124+
});
125+
document.body.appendChild(script);
115126
</script>
116127
</head>
117128

0 commit comments

Comments
 (0)