Skip to content

Commit

Permalink
Use interval timer to render text emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
zk-phi committed Jun 1, 2022
1 parent 317381c commit 55178a6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/cards/TextSource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export default defineComponent({
lineSpacing: 0.05,
},
showDetails: false,
timer: null as (number | null),
modified: false,
};
},
computed: {
Expand All @@ -80,13 +82,24 @@ export default defineComponent({
conf: {
handler(): void {
Analytics.changeFont(this.conf.font);
this.render();
this.modified = true;
},
deep: true,
},
},
mounted() {
Analytics.changeFont(this.conf.font);
this.timer = window.setInterval(() => {
if (this.modified) {
this.modified = false;
this.render();
}
}, 100);
},
beforeUnmount() {
if (this.timer) {
window.clearInterval(this.timer);
}
},
methods: {
render(): void {
Expand Down

0 comments on commit 55178a6

Please sign in to comment.