Alternative to DOMSubTreeModified event in JavaScript

I am developing a custom translation extension for GMail in chrome and need to trigger the content script when the user clicks on an email in his inbox.

Since GMail uses AJAX, I decided to use the DOMSubTreeModified event. My extension works, but it seems via console logging that the function that sits the translate keeps getting executed constantly, even though the email text remains the same.

DOMContentLoaded does not trigger. Can anyone suggest any alternative I can use? I guess a timer or something in GMail constantly updates the page and makes minor adjustments. I had even narrowed the element on which the event is generated.

Answers


It appears that you should be using gmail-specific events to know when a new email is loaded, not generic DOM events. This add-on is not official Google code, but if you look at how it works, you could probably discover how to observe all sorts of gmail events or you could just use it to solve your problems.


Need Your Help

PHP: Wordpress cycle through categories and output all posts images

php wordpress image twitter-bootstrap

I have a bootstrap "tab" system going on where each tab is it's own category name:

Apache Lucene doesn't filter stop words despite the usage of StopAnalyzer and StopFilter

java apache lucene information-retrieval stop-words

I have a module based on Apache Lucene 5.5 / 6.0 which retrieves keywords. Everything is working fine except one thing — Lucene doesn't filter stop words.