uProxy/uproxy — pull request #729 by dborkan (2014-12-20 00:55:22+00:00)
Title: Change User and RemoteInstance objects to be asynchronously constructed

User and RemoteInstance objects had been using storage.load within their constructors. Because storage.load is an async function, this resulted in User objects in the network.roster and RemoteInstance objects in the user.instances_ array that were not fully ready for use.

I've changed both User and RemoteInstance objects to have a static .create method, which acts as a factory, and returns Promises that get fulfilled when the User/RemoteInstance objects are fully ready for use. This way we will no longer have any partially constructed Users in network.roster or RemoteInstances in user.instances_, and don't need public variables like isReadFromStorage.

This also fixes https://github.com/uProxy/uproxy/issues/721

Tested in Chrome, updated "grunt test" to reflect new async behavior