I am sure this answer is floating around somewhere, but I haven't found the right search terms to reveal anything on Google yet that addresses it...
I am using ASP.Net Core MVC to essentially create a simple single-page application. The template and its scripts are loaded when the site is initially loaded, but subsequent navigation requests just use AJAX to get a partial view that contains the new page content and any page-specific script tags. I then insert the partial view into the template's content area (the idea is to avoid interrupting websocket connections and long-running javascript tasks hosted by the template.)
Any page-specific javascript related to the partial view must be passed in with the partial view. This is working fine, but I don't understand the lifecycle of Javascript well enough to know whether these scripts "go away" when I load the next partial view, or whether it "piles up" and causes memory leaks, performance issues, etc. Is any manual cleanup necessary in order to keep this type of application behaving as expected, or do these scripts get automatically cleaned up when the partial view containing the script tags is replaced? Thanks in advance!