Added docs (and observations) to notes count.

This commit is contained in:
Mizah 2024-11-17 12:54:26 +02:00
parent ecb990fb77
commit aeb568664d

View file

@ -56,13 +56,32 @@ export function signinRequired() {
return $i;
}
/**
* Extracts the current number of notes from the current account.
*
* Note: This appears to only be used for the "notes1" achievement.
*
* Also, separating it like this might cause counts to get out-of-sync.
*/
export let notesCount = $i == null ? 0 : $i.notesCount;
/**
* Increments the number of notes by one.
*
* Documentation TODO: What about $i.notesCount? Why not increment that?
*/
export function incNotesCount() {
notesCount++;
}
export async function signout() {
if (!$i) return;
// If we're not signed in, there's nothing to do.
if (!$i) {
// Error log:
console.error('signout() called when not signed in');
return;
}
waiting();
miLocalStorage.removeItem('account');