diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2021-02-20 15:57:30 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2021-02-20 15:57:30 +0900 |
| commit | 65fbca47f9831a2850c5c10e1f93520cc6f19203 (patch) | |
| tree | 5436d9b750cbdf96a262866f6bf223f0155d9733 /src/client/widgets | |
| parent | ChatUIで選択したタイムラインを記憶するように (diff) | |
| download | misskey-65fbca47f9831a2850c5c10e1f93520cc6f19203.tar.gz misskey-65fbca47f9831a2850c5c10e1f93520cc6f19203.tar.bz2 misskey-65fbca47f9831a2850c5c10e1f93520cc6f19203.zip | |
Improve widget performance
Diffstat (limited to 'src/client/widgets')
| -rw-r--r-- | src/client/widgets/define.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client/widgets/define.ts b/src/client/widgets/define.ts index b5498204b3..08a346d97c 100644 --- a/src/client/widgets/define.ts +++ b/src/client/widgets/define.ts @@ -1,4 +1,5 @@ import { defineComponent } from 'vue'; +import { throttle } from 'throttle-debounce'; import { Form } from '@/scripts/form'; import * as os from '@/os'; @@ -21,7 +22,10 @@ export default function <T extends Form>(data: { data() { return { - props: this.widget ? JSON.parse(JSON.stringify(this.widget.data)) : {} + props: this.widget ? JSON.parse(JSON.stringify(this.widget.data)) : {}, + save: throttle(3000, () => { + this.$emit('updateProps', this.props); + }), }; }, @@ -66,10 +70,6 @@ export default function <T extends Form>(data: { this.save(); }, - - save() { - this.$emit('updateProps', this.props); - } } }); } |