Skip to content

Commit

Permalink
Update documentation for Users api
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenvergenz committed Mar 29, 2018
1 parent 94edb28 commit 50a15ee
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 5 deletions.
1 change: 1 addition & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'js/joint-collision-push.html',
'js/gamepad-cube.html',
'js/touchpad-cube.html',
'js/user-api.html',
'js/living-room/',
'js/stonehenge/',
'js/telekinetic-cubes/',
Expand Down
31 changes: 31 additions & 0 deletions examples/js/user-api.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Test Users API</title>
<style>
body {
background-color: white;
font-size: 200%;
}
</style>
</head>
<body>
<script>

altspace.getUser().then(function(user)
{
var p = document.createElement('p');
p.innerHTML = 'User data: '+JSON.stringify(user, null, ' ');
document.body.appendChild(p);

user.addEventListener('avatarchange', function(evt){
var p = document.createElement('p');
p.innerHTML = 'Avatar change: '+ JSON.stringify(evt.data);
document.body.appendChild(p);
});
});

</script>
</body>
</html>
28 changes: 23 additions & 5 deletions src/core/User.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
'use strict';

/**
* Details of a user.
* @typedef {Object} module:altspace~User
* @property {String} userId Unique id for this user.
* @property {String} displayName The user's chosen display name.
* @property {Boolean} isModerator True if the user should be able to moderate apps
* Details of an Altspace user.
* @class module:altspace~User
* @memberof module:altspace
* @property {String} userId - Unique id for this user (per site origin)
* @property {String} displayName - The user's chosen display name.
* @property {Boolean} isModerator - True if the user should be able to moderate apps.
* @property {Object} avatarInfo - What avatar the user is wearing
* @property {String} avatarInfo.sid - The series ID of the avatar. Will be one of:
* "rubenoid-male-01" (human male), "rubenoid-female-01" (human female),
* "s-series-m01" (robot male), "s-series-f01" (robot female),
* "pod-classic" (rounded robot), "a-series-m01" (swirled robot), "x-series-m02" (visor robot),
* "robothead-propellerhead-01" (helicopter robot), "robothead-roundguy-01" (bumblebee robot),
* or other future avatar models.
* @property {String} avatarInfo.primaryColor - The main color of the avatar (s, a, x, and pod series only)
* @property {String} avatarInfo.highlightColor - The accent color of the avatar (s, a, x, and pod series only)
* @property {Array} avatarInfo.textures - Texture selection IDs (rubenoids only)
*/

/**
* The avatarchange event is fired when the user changes their avatar.
* @event avatarchange
* @memberof module:altspace~User
* @property {Object} data - The new avatar info, in the same format as User.avatarInfo
*/

/**
Expand Down

0 comments on commit 50a15ee

Please sign in to comment.