In addition to our class inheritance framework, and of course jQuery, we’ve created our own set of modules that we call The G Framework. Why G? Well, we didn’t want our JS variables polluting the global environment — we wanted to subordinate them all under a single namespace, and we wanted to give it a short name that was easy to type. And if you’re going to type a short namespace name whenever you need to use a variable, then you obviously want to type it with your index finger. So “G” was the obvious choice.
One feature of the G Framework is a solution for keeping track of database data passed in from the server (either through AJAX, or dumped into a script tag that gets evaluated on page load). The basic idea is to have client-side classes that roughly map to database entities, and create a centralized client-side key-based hash of all the data we’ve downloaded and cached.
It’s all powered by the G.data module, which you can see at http://quixey.com/static/js/data.js. It defines a base class, called G.Data, which all other data classes (e.g. G.data.App, G.data.User) inherit from. Check out some of the functionality that is common to G.data objects: