Refresh local avatars/worlds button

This commit is contained in:
Natsumi
2024-11-05 17:52:08 +13:00
parent 7f08dc0350
commit 65c8ad4161
3 changed files with 69 additions and 7 deletions

View File

@@ -19800,6 +19800,29 @@ speechSynthesis.getVoices();
$app.getLocalWorldFavorites();
});
$app.methods.refreshLocalWorldFavorites = async function () {
if (this.refreshingLocalFavorites) {
return;
}
this.refreshingLocalFavorites = true;
for (var worldId of this.localWorldFavoritesList) {
if (!this.refreshingLocalFavorites) {
break;
}
try {
await API.getWorld({
worldId
});
} catch (err) {
console.error(err);
}
await new Promise((resolve) => {
workerTimers.setTimeout(resolve, 1000);
});
}
this.refreshingLocalFavorites = false;
};
$app.data.worldFavoriteSearch = '';
$app.data.worldFavoriteSearchResults = [];
@@ -20188,6 +20211,31 @@ speechSynthesis.getVoices();
});
};
$app.data.refreshingLocalFavorites = false;
$app.methods.refreshLocalAvatarFavorites = async function () {
if (this.refreshingLocalFavorites) {
return;
}
this.refreshingLocalFavorites = true;
for (var avatarId of this.localAvatarFavoritesList) {
if (!this.refreshingLocalFavorites) {
break;
}
try {
await API.getAvatar({
avatarId
});
} catch (err) {
console.error(err);
}
await new Promise((resolve) => {
workerTimers.setTimeout(resolve, 1000);
});
}
this.refreshingLocalFavorites = false;
};
$app.data.avatarFavoriteSearch = '';
$app.data.avatarFavoriteSearchResults = [];