Google Chrome Extension in Single Page App resets injected Content Script variables

I have a Single Page Application and developed an extension in Goolge Chrome that adds a DevTools panel with a button.

When I click the button on Chrome DevTools the file record.js is injected to the page.

record.js has a variable called window.loggedin the the valued false. This variable is updated to true when the user performs the login correctly.

After the user correctly logged-in is taken to another page. Again, this is a Single Page Application the page doesn’t perform a refresh.

Meanwhile window.loggedin, which is defined in the injected content script record.js, is reset back to false.

How do I prevent the variable window.loggedin from being initialized back to false when the user performs the login?