mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 15:32:40 -05:00
25 lines
539 B
JavaScript
25 lines
539 B
JavaScript
|
class UserData {
|
||
|
constructor () {
|
||
|
this._username = '';
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 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;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Getter for username. Initially empty string, until set via postData.
|
||
|
* @returns {!string} The current username
|
||
|
*/
|
||
|
getUsername () {
|
||
|
return this._username;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = UserData;
|