I am developing a custom template for Canvas LMS and Canvas allows to upload .js and .css file. To test any changes in .js I have to re-upload .js and refresh which is time consuming. So to get around this situation I thought about hosting one js file in Git and upload another js script in Canvas with some code to facilitate link between .js (Canvas and Git).
It works but, when I commit new changes then it stops working. In brief it fails to read latest commit and keeps loading previous commit.
Codes that I am testing with are provided below:
Canvas.js is the script that I upload in Canvas LMS:
document.addEventListener("DOMContentLoaded", function() { var link = document.querySelector(".customAlertLink"); if (link) { link.addEventListener("click", function(event) { event.preventDefault(); alert("This alert is from the script hosted on GitHub!"); }); } });