Javascript Asset Manager using the Q promises library