Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to preload emote cache from object #19

Open
tadev opened this issue Jul 4, 2024 · 1 comment
Open

Ability to preload emote cache from object #19

tadev opened this issue Jul 4, 2024 · 1 comment

Comments

@tadev
Copy link

tadev commented Jul 4, 2024

Hey, thank you for this library - currently experimenting with it and found that page load times are really slow because emotettv has to reload all the emotes every time the page is loaded. It would be incredibly helpful if the emote parser offered a function to export and import cached emotes per channel, this way emotes could be cached on the server side while still benefitting from the incredible performance of your parser.
Do you have any clues on how to implement this?

@doceazedo
Copy link
Owner

Hi! I really like your suggestion :) For starters, we would need to add an export() function to EmotesParser. We can also add an optional data parameter to EmotesLoader (or something similar). From there, we can create exportEmotes() and exportBadges(). It might also be useful to add an event dispatcher to track when the emote/badge data changes...

Once these are implemented in emotettv, you could fetch the emotes using exportEmotes() (or when the event is triggered), save them wherever you want, and then pass the exported data to reloadEmotes(...) later on. Would this work for you?

I might have some time to implement this over the next few days or if you want to submit a PR yourself, feel free to do so!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants