soiz1's picture
Upload 811 files
30c32c8 verified
raw
history blame
880 Bytes
class UserData {
constructor () {
this._username = '';
this._loggedIn = false;
}
/**
* Handler for updating the username
* @param {object} data Data posted to this ioDevice.
* @property {!string} username The new username.
*/
postData (data) {
this._username = data.username;
this._loggedIn = false;
if (data.loggedIn === true) {
this._loggedIn = true;
}
}
/**
* Getter for username. Initially empty string, until set via postData.
* @returns {!string} The current username
*/
getUsername () {
return this._username;
}
/**
* Getter for loggedIn. Will be false, until set via postData.
* @returns {boolean} The current loggedIn state
*/
getLoggedIn() {
return this._loggedIn;
}
}
module.exports = UserData;