How to simply express a desire to run a function when two properties are true?
jQuery.Deferred, or even just promises in general, would make your code simpler. In short, a promise can be unfulfilled, fulfilled, or failed. jQuery.when lets you compose multiple promises into one promise that's fulfilled when they're all fulfilled or failed as soon as one fails. This means that you can


create Deferreds for each event you want to monitor:

var userLoaded = new $.Deferred();
var playerReady = new $.Deferred();

Resolve the promises when whatever event they represent has completed, e.g.:

userLoaded.resolve();


If there's an error, you can signal that if you want as well:

userLoaded.reject();

Compose them together:

$.when(userLoaded, playerReady).then(function() {
    require(['foreground']);
});


If you pass a second argument to then, it will be called if either of the promises are rejected, simplifying error-handling, should you wish to do that.