SpecsUser
ClassA User backed by a Specs (Spectacles) account, which may or may not have a Snapchat account linked.
- Snapchat: not supported
- SPECS: fully supported
- Camera Kit Web: not supported
- Camera Kit Mobile: not supported
- SnapchatNot supported — Available on SPECS only
- SPECSFully supported
- Camera Kit WebNot supported — Available on SPECS only
- Camera Kit MobileNot supported — Available on SPECS only
Since Lens Scripting v378
A User backed by a Specs (Spectacles) account, which may or may not have a Snapchat
account linked. Only available in the SnapOS runtime. Exposes the shared User fields;
Specs accounts have no friend graph today, so User#friendInfo is always null here.
Specs-specific fields may be added later.
Index
Properties
Methods
Example
global.userContextSystem.getCurrentUser(function (user) {
if (user.accountType === AccountType.Specs) {
// On Spectacles the current user is a SpecsUser.
print("Specs user id: " + user.userId);
}
});
Extends
Properties
accountType
readonlyaccountType:AccountType
The kind of account backing this user — AccountType Snapchat or Specs. Branch on this rather than inspecting the concrete class.
Since
Lens Scripting Version 378
Example
global.userContextSystem.getCurrentUser(function (user) {
if (user.accountType === AccountType.Snapchat) {
print("Snapchat account");
} else if (user.accountType === AccountType.Specs) {
print("Specs account");
}
});
Inherited from
birthday
readonlybirthday:UserBirthday
The user's birth month and day. The month and day will start with the index of 1. Present only when the account provides a birthdate.
Since
Lens Scripting Version 378
Inherited from
displayName
readonlydisplayName:string
The name a user has chosen to be shown as. Note that not all users set a display name, so you should treat this value as such.
Since
Lens Scripting Version 378
Inherited from
friendInfo
readonlyfriendInfo:SnapchatFriendUserInfo
Information about friendship between this user and the active user, like start date and streak.
Only accounts whose runtime serves friend data populate this; it is always null for a
SpecsUser, because Specs accounts have no friend graph today.
Since
Lens Scripting Version 378
Inherited from
hasBitmoji
readonlyhasBitmoji:boolean
Whether this user has a Bitmoji that can be retrieved via BitmojiModule.
Inherited from
userName
readonlyuserName:string
The user's unique userName (@handle). Should not be relied on as a key because it can be changed.
Since
Lens Scripting Version 378
Inherited from
zodiac
readonlyzodiac:Zodiac
This user's zodiac, derived from their birthday.
Since
Lens Scripting Version 378
Inherited from
Methods
getTypeName()
staticgetTypeName():TypeName<SpecsUser>
SPECS
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<SpecsUser>
Since
Lens Scripting Version 378
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean