Interface: UsersApi
Defined in: preload.ts:196
The people sharing the app, as window.tankobon.users. Each has a nickname and a picture (no password); ratings, tags, progress, reading lists, history, achievements and most settings are personal, the library and its organization are common. Edits always concern the active user.
Methods
create()
create(
nickname):Promise<UserResult>
Defined in: preload.ts:200
Adds a user (nickname trimmed, not empty, unique ignoring case) with the default picture; it doesn't switch to them.
Parameters
nickname
string
Returns
Promise<UserResult>
list()
list():
Promise<UsersState>
Defined in: preload.ts:198
Every user and the active one's id.
Returns
Promise<UsersState>
pickAvatar()
pickAvatar():
Promise<PickAvatarResult>
Defined in: preload.ts:206
Opens a native picker for the active user's picture and returns the picked file's bytes (a PNG, JPEG or WebP), for the renderer to shrink before setAvatar().
Returns
Promise<PickAvatarResult>
remove()
remove():
Promise<UserResult>
Defined in: preload.ts:212
Deletes the active user and all their personal data (progress, ratings, tags, lists, statistics, achievements, settings); the library is untouched. Refused for the last remaining user. On success the result is the user the app switched to.
Returns
Promise<UserResult>
removeAvatar()
removeAvatar():
Promise<UserResult>
Defined in: preload.ts:210
Puts the active user's default picture back.
Returns
Promise<UserResult>
rename()
rename(
nickname):Promise<UserResult>
Defined in: preload.ts:204
Changes the active user's nickname.
Parameters
nickname
string
Returns
Promise<UserResult>
setAvatar()
setAvatar(
bytes):Promise<UserResult>
Defined in: preload.ts:208
Stores the active user's picture (PNG, JPEG or WebP of at most 256 KiB).
Parameters
bytes
Uint8Array
Returns
Promise<UserResult>
switch()
switch(
id):Promise<UserResult>
Defined in: preload.ts:202
Makes another user the active one: everything personal, and the interface language, follow. data:changed announces it to every window.
Parameters
id
string
Returns
Promise<UserResult>