Improve performance

This commit is contained in:
syuilo 2020-11-03 15:49:31 +09:00
parent ab692cfa3d
commit ab166959a4
2 changed files with 5 additions and 6 deletions

View File

@ -28,7 +28,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent, markRaw } from 'vue';
import { emojilist } from '../../misc/emojilist'; import { emojilist } from '../../misc/emojilist';
import contains from '@/scripts/contains'; import contains from '@/scripts/contains';
import { twemojiSvgBase } from '../../misc/twemoji-base'; import { twemojiSvgBase } from '../../misc/twemoji-base';
@ -124,7 +124,6 @@ export default defineComponent({
emojis: [], emojis: [],
items: [], items: [],
select: -1, select: -1,
emojilist,
emojiDb: [] as EmojiDef[] emojiDb: [] as EmojiDef[]
} }
}, },
@ -178,7 +177,7 @@ export default defineComponent({
emojiDefinitions.sort((a, b) => a.name.length - b.name.length); emojiDefinitions.sort((a, b) => a.name.length - b.name.length);
this.emojiDb = emojiDefinitions.concat(emjdb); this.emojiDb = markRaw(emojiDefinitions.concat(emjdb));
//#endregion //#endregion
this.textarea.addEventListener('keydown', this.onKeydown); this.textarea.addEventListener('keydown', this.onKeydown);

View File

@ -63,7 +63,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent, markRaw } from 'vue';
import { emojilist } from '../../misc/emojilist'; import { emojilist } from '../../misc/emojilist';
import { getStaticImageUrl } from '@/scripts/get-static-image-url'; import { getStaticImageUrl } from '@/scripts/get-static-image-url';
import { faAsterisk, faLeaf, faUtensils, faFutbol, faCity, faDice, faGlobe, faHistory, faUser } from '@fortawesome/free-solid-svg-icons'; import { faAsterisk, faLeaf, faUtensils, faFutbol, faCity, faDice, faGlobe, faHistory, faUser } from '@fortawesome/free-solid-svg-icons';
@ -86,7 +86,7 @@ export default defineComponent({
data() { data() {
return { return {
emojilist, emojilist: markRaw(emojilist),
getStaticImageUrl, getStaticImageUrl,
customEmojis: {}, customEmojis: {},
faGlobe, faHistory, faGlobe, faHistory,
@ -137,7 +137,7 @@ export default defineComponent({
created() { created() {
let local = this.$store.state.instance.meta.emojis; let local = this.$store.state.instance.meta.emojis;
local = groupByX(local, (x: any) => x.category || ''); local = groupByX(local, (x: any) => x.category || '');
this.customEmojis = local; this.customEmojis = markRaw(local);
}, },
methods: { methods: {