Spaces:
Build error
Build error
File size: 880 Bytes
30c32c8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
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;
|