refactor(utils.ts): add parameter arg0 to addWatcher callback for improved readability

This commit is contained in:
Sped0n
2023-11-02 12:27:58 +08:00
parent 8b48cceb8f
commit dd01dd8bec
5 changed files with 14 additions and 14 deletions

View File

@@ -38,8 +38,8 @@ export function initCustomCursor(): void {
// bind mousemove event to window
window.addEventListener('mousemove', onMouse, { passive: true })
// add active callback
active.addWatcher(() => {
if (active.get()) {
active.addWatcher((o) => {
if (o) {
cursor.classList.add('active')
} else {
cursor.classList.remove('active')

View File

@@ -211,13 +211,13 @@ export function initStage(ijs: ImageJSON[]): void {
})
window.addEventListener('mousemove', onMouse, { passive: true })
// watchers
isOpen.addWatcher(() => {
active.set(isOpen.get() && !isAnimating.get())
isOpen.addWatcher((o) => {
active.set(o && !isAnimating.get())
})
isAnimating.addWatcher(() => {
active.set(isOpen.get() && !isAnimating.get())
isAnimating.addWatcher((o) => {
active.set(isOpen.get() && !o)
})
cordHist.addWatcher(() => {
cordHist.addWatcher((_) => {
setPositions()
})
// preload