Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Jul 4, 2024
1 parent b5c0398 commit 30eeac9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions view/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4365,10 +4365,12 @@ function callFunctionOrLoadScript(funcName, jsUrl, ...args) {
const script = document.createElement('script');
script.src = jsUrl;

console.error(`Function ${funcName} not found loading script ${jsUrl}`);
// Define what happens when the script is loaded
script.onload = function() {
// Check again if the function exists after loading the script
if (typeof window[funcName] === 'function') {
console.error(`Function ${funcName} found after loading script ${jsUrl}`);
window[funcName](...args);
} else {
console.error(`Function ${funcName} does not exist even after loading the script.`);
Expand Down

0 comments on commit 30eeac9

Please sign in to comment.