ttop32 / MouseTooltipTranslator

Mouseover Translate Any Language At Once - Chrome Extension: PDF Translator, EBOOK, EPUB, OCR, TTS, YOUTUBE DUAL SUBTITLES, GOOGLE DOCS, AI, VIEWER, GMAIL, WRITING, IMAGE, DUAL SUBS, MANGA, HOVER, DICTIONARY, WEBTOON, EDGE, JAPANESE, ENGLISH
MIT License
678 stars 107 forks source link

Fire extension onMouseMove instead of on interval #129

Closed skfh82 closed 6 months ago

skfh82 commented 6 months ago

Currently, the extension is relying on setInterval to determine when to fire. This can cause the function to fire an excessive amount of times even when the page is idle, contributing to CPU usage. The problem is worse when more tabs are opened.

Instead, it's better to fire immediately on mouse move, with a delay if the function had recently been fired. Doing this also allows the default time delay to be reduced.

ttop32 commented 6 months ago

I appreciate your help and support. This way give huge advantage to reduce resource uses :)

I considered short inteveral time also. But, short inteveral time may cause translate api ban because of too many request. I will try it to use it but this feature may can be rollback.