improvements on svelte store + handling
This commit is contained in:
parent
e553392d9d
commit
3080e1fdc7
4 changed files with 29 additions and 22 deletions
|
@ -5,7 +5,7 @@
|
|||
import { emoteStore, emoteMenuStore } from "../../Stores/EmoteStore";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import { EmojiButton } from '@joeattardi/emoji-button';
|
||||
|
||||
|
||||
let emojiContainer: HTMLElement;
|
||||
let picker: EmojiButton;
|
||||
|
||||
|
@ -26,11 +26,11 @@
|
|||
});
|
||||
|
||||
picker.on("hidden", () => {
|
||||
emoteMenuStore.set(false);
|
||||
emoteMenuStore.closeEmoteMenu();
|
||||
});
|
||||
|
||||
unsubscriber = emoteMenuStore.subscribe(() => {
|
||||
if (get(emoteMenuStore)) {
|
||||
unsubscriber = emoteMenuStore.subscribe((isEmoteMenuVisible) => {
|
||||
if (isEmoteMenuVisible && !picker.isPickerVisible()) {
|
||||
picker.showPicker(emojiContainer);
|
||||
} else {
|
||||
picker.hidePicker();
|
||||
|
@ -42,6 +42,8 @@
|
|||
if (unsubscriber) {
|
||||
unsubscriber();
|
||||
}
|
||||
|
||||
picker.destroyPicker();
|
||||
})
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue