Can webflow pull data from the database and assign it to global js variables in real time when the data values from the database change?
Nope. Not a current feature on the platform. You may want to consider using an API that does.
No, Webflow itself does not have the capability to directly pull data from a database and assign it to global JavaScript variables in real time when the data values change. Webflow is primarily a visual website builder that focuses on front-end development and provides a content management system (CMS) for managing website content. Try also solving the problem via https://www.devart.com/dac.html
Look into Wized. It may have AJAX subscription hooks that allow your application server to push updates to your active browser clients.