2 * Provides data of the active user.
4 * @author Matthias Schmidt
5 * @copyright 2001-2018 WoltLab GmbH
6 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
7 * @module WoltLabSuite/Core/User
9 define([], function() {
16 * @exports WoltLabSuite/Core/User
20 * Returns the link to the active user's profile or an empty string
21 * if the active user is a guest.
30 * Initializes the user object.
32 * @param {int} userId id of the user, `0` for guests
33 * @param {string} username name of the user, empty for guests
34 * @param {string} userLink link to the user's profile, empty for guests
36 init: function(userId
, username
, userLink
) {
38 throw new Error('User has already been initialized.');
41 // define non-writeable properties for userId and username
42 Object
.defineProperty(this, 'userId', {
46 Object
.defineProperty(this, 'username', {