Streams.Avatar Class
Constructs an avatar from fields, which are typically returned from the server.
Constructor
Methods
byPrefix
-
prefix
-
callback
-
[options]
Get avatars by prefix
Parameters:
displayName
-
[options]
-
[fallback='Someone']
Get the display name from a Streams.Avatar
Parameters:
-
[options]
Object optionalA bunch of options which can include:
-
[short]
Boolean optionalShow one part of the name only
-
[show]
Boolean optionalThe parts of the name to show. Can have "f", "fu", "l", "lu", "flu" and "u" separated by spaces. The "fu" and "lu" represent firstname or lastname with fallback to username, while "flu" is "firstname lastname" with a fallback to username.
-
[html]
Boolean optionalIf true, encloses the first name, last name, username in span tags. If an array, then it will be used as the attributes of the html.
-
[escape]
Boolean optionalIf true, does HTML escaping of the retrieved fields
-
-
[fallback='Someone']
String optionalWhat to return if there is no info to get displayName from.
Returns:
get
-
userId
-
callback
Avatar batch getter.
Parameters:
-
userId
String | ObjectThe id of the user whose avatar we are requesting. Alternatively, this can also be an object with keys "prefix", "limit", "offset"
-
callback
Functionif there were errors, first parameter is an array of errors otherwise, first parameter is null and second parameter is a Streams.Avatar object
Events
avatar.onError
Occurs when Avatar.get encounters an error loading an avatar from the server
byPrefix.onError
Occurs when Avatar.byPrefix encounters an error loading avatar from the server