nx.js
NamespacesSwitchClasses

Profile

Represents a user profile that exists on the system.

Constructors

new Profile()

new Profile(uid): Profile

Creates a new Profile instance from the given profile UID.

Parameters

ParameterType
uidProfileUid

Returns

Profile

Example

const profile = new Switch.Profile([
  0x10005d4864d166b7n,
  0x965b8cb028cd8a81n,
]);
console.log(profile.nickname);

Properties

PropertyModifierTypeDescription
imagereadonlyArrayBufferThe raw JPEG data for the profile image. Can be decoded with the Image class.
nicknamereadonlystringThe human readable nickname of the profile.
uidreadonlyProfileUidThe unique ID of the profile, represented as an array of two bigint values.

Accessors

current

get static current(): null | Profile

set static current(v): void

Gets or sets the "current" user profile.

Initially, this value will correspond to the user profile that was selected via the user selection interface when the application was launched.

Will be null if no user profile is currently selected.

Example

const profile = Switch.Profile.current;
if (profile) {
  console.log(`Current user: ${profile.nickname}`);
} else {
  console.log('No user is currently selected');
}

Parameters

ParameterType
vnull | Profile

Returns

null | Profile

Methods

[iterator]()

static [iterator](): Generator<Profile, void, unknown>

Can be used as an iterator to retrieve the list of user profiles.

Returns

Generator<Profile, void, unknown>

Example

for (const profile of Switch.Profile) {
  console.log(profile.nickname);
}

select()

static select(): null | Profile

Shows the user selection interface and returns a Profile instance representing the user that was selected.

Returns

null | Profile

Note

This function blocks the event loop until the user has made their selection.

On this page