I'm trying to do perform an asynchronous operation that will grab data and affect the style of my webpage.
Is there a way to make this operation finish before the page loads? Since I want to change an actual attribute of a div element, I know this is unlikely but I'd like to get your guys ideas on how to accomplish this.
Maybe by storing the data in the browser session or something so that it only has to think one? I'm not sure
var grab_user = new Firebase("https://<FIREBASE>.firebaseio.com/users/"+auth.uid);
//grab data from firebase
grab_user.once('value', function (dataSnapshot) {
var $user = dataSnapshot.val();
//if the user has this object,
//change the head color to whats in their settings
if($user.whitelabel)
$("#top-header").css('background-color', $user.whitelabel.color);
});