refactor name and icon get
This commit is contained in:
@@ -2,7 +2,7 @@ import { get, writable, type Writable } from "svelte/store";
|
||||
import { DataBase, type Chat, type character, type groupChat } from "./storage/database";
|
||||
import { isEqual } from "lodash";
|
||||
import type { simpleCharacterArgument } from "./parser";
|
||||
import { sleep } from "./util";
|
||||
import { getUserIcon, getUserName, sleep } from "./util";
|
||||
import { getModules } from "./process/modules";
|
||||
|
||||
function updateSize(){
|
||||
@@ -76,8 +76,8 @@ function trySync(){
|
||||
CurrentCharacter.set(structuredClone(currentCharacter))
|
||||
CurrentSimpleCharacter.set(createSimpleCharacter(currentCharacter))
|
||||
CurrentChat.set(structuredClone(currentChat))
|
||||
CurrentUsername.set(db.username)
|
||||
CurrentUserIcon.set(db.userIcon)
|
||||
CurrentUsername.set(getUserName())
|
||||
CurrentUserIcon.set(getUserIcon())
|
||||
CurrentShowMemoryLimit.set(db.showMemoryLimit)
|
||||
} catch (error) {}
|
||||
}
|
||||
@@ -132,10 +132,10 @@ async function preInit(){
|
||||
|
||||
DataBase.subscribe((data) => {
|
||||
updateCurrentCharacter()
|
||||
if(data.username !== get(CurrentUsername)){
|
||||
CurrentUsername.set(data.username)
|
||||
if(getUserName() !== get(CurrentUsername)){
|
||||
CurrentUsername.set(getUserName())
|
||||
}
|
||||
if(data.userIcon !== get(CurrentUserIcon)){
|
||||
if(getUserIcon() !== get(CurrentUserIcon)){
|
||||
CurrentUserIcon.set(data.userIcon)
|
||||
}
|
||||
if(data.showMemoryLimit !== get(CurrentShowMemoryLimit)){
|
||||
@@ -189,6 +189,14 @@ async function preInit(){
|
||||
return
|
||||
}
|
||||
|
||||
if(getUserName() !== get(CurrentUsername)){
|
||||
CurrentUsername.set(getUserName())
|
||||
}
|
||||
|
||||
if(getUserIcon() !== get(CurrentUserIcon)){
|
||||
CurrentUserIcon.set(getUserIcon())
|
||||
}
|
||||
|
||||
const variablePointer = get(CurrentVariablePointer)
|
||||
const currentState = structuredClone(chat?.scriptstate)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user