Update pizzax.ts

This commit is contained in:
syuilo 2025-03-10 21:44:23 +09:00
parent 2493592bd0
commit 2402754dcc
1 changed files with 5 additions and 3 deletions

View File

@ -45,12 +45,14 @@ export class Pizzax<Data extends Record<string, any>> extends EventEmitter<Pizza
}
public commit<K extends keyof Data>(key: K, value: Data[K]) {
this.r[key].value = this.s[key] = value;
this.emit('updated', { key, value });
const v = JSON.parse(JSON.stringify(value)); // deep copy 兼 vueのプロキシ解除
this.r[key].value = this.s[key] = v;
this.emit('updated', { key, value: v });
}
public rewrite<K extends keyof Data>(key: K, value: Data[K]) {
this.r[key].value = this.s[key] = value;
const v = JSON.parse(JSON.stringify(value)); // deep copy 兼 vueのプロキシ解除
this.r[key].value = this.s[key] = v;
}
/**