I'm writing an extension that talks with an outside process, so it is kind of no-brainer to lower the amount of 'hey whats up'- requests when my buffer isn't focused.

What is the best way to recognize that:

 1. my buffer is visible and focused 
 2. my buffer is visible but not focused 
 3. my buffer is neither visible nor focused