diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2021-03-05 13:49:46 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2021-03-05 13:49:46 +0900 |
| commit | f871cf10538cc35d67114d780ec13afa4d30903c (patch) | |
| tree | 54ea2d2fd2706376513bfafc6c03fb6936587ed2 /src/client/scripts | |
| parent | Merge pull request #7295 from syuilo/dependabot/npm_and_yarn/typescript-eslin... (diff) | |
| download | sharkey-f871cf10538cc35d67114d780ec13afa4d30903c.tar.gz sharkey-f871cf10538cc35d67114d780ec13afa4d30903c.tar.bz2 sharkey-f871cf10538cc35d67114d780ec13afa4d30903c.zip | |
Improve reaction picker performance
Diffstat (limited to 'src/client/scripts')
| -rw-r--r-- | src/client/scripts/reaction-picker.ts | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/client/scripts/reaction-picker.ts b/src/client/scripts/reaction-picker.ts new file mode 100644 index 0000000000..e923326ece --- /dev/null +++ b/src/client/scripts/reaction-picker.ts @@ -0,0 +1,41 @@ +import { Ref, ref } from 'vue'; +import { popup } from '@/os'; + +class ReactionPicker { + private src: Ref<HTMLElement | null> = ref(null); + private manualShowing = ref(false); + private onChosen?: Function; + private onClosed?: Function; + + constructor() { + // nop + } + + public async init() { + await popup(import('@/components/emoji-picker-dialog.vue'), { + src: this.src, + asReactionPicker: true, + manualShowing: this.manualShowing + }, { + done: reaction => { + this.onChosen!(reaction); + }, + close: () => { + this.manualShowing.value = false; + }, + closed: () => { + this.src.value = null; + this.onClosed!(); + } + }); + } + + public show(src: HTMLElement, onChosen: Function, onClosed: Function) { + this.src.value = src; + this.manualShowing.value = true; + this.onChosen = onChosen; + this.onClosed = onClosed; + } +} + +export const reactionPicker = new ReactionPicker(); |