Skip to content

Commit

Permalink
Console error - doSearch is not defined sugarlabs#4074
Browse files Browse the repository at this point in the history
  • Loading branch information
ben9lee committed Nov 29, 2024
1 parent b5be318 commit feecc13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@
}
</script>
<script type="text/javascript">
$(document).ready(function() {
doSearch();
$(document).ready(function () {
$(document).on('globalActivityReady', function () {
window.globalActivity.doSearch();
});
});
</script>
</head>
Expand Down
7 changes: 6 additions & 1 deletion js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class Activity {
*/
constructor() {
globalActivity = this;
window.globalActivity = this;

this.cellSize = 55;
this.searchSuggestions = [];
Expand Down Expand Up @@ -6949,10 +6950,14 @@ class Activity {

const activity = new Activity();

require(["domReady!"], (doc) =>{
require(["domReady!"], (doc) => {
setTimeout(() => {
activity.setupDependencies();
activity.domReady(doc);

// Dispatch a custom event to signal that globalActivity is ready
const event = new CustomEvent('globalActivityReady');
document.dispatchEvent(event);
}, 5000);
});

Expand Down

0 comments on commit feecc13

Please sign in to comment.