adobe/brackets — pull request #2473 by gruehle (2013-01-04 00:34:57+00:00)
Title: Add "keep alive" test for Live Preview

Fix for #2267

Add a "keep alive" test to Live Preview.

Once a second, Brackets will call the `keepAlive()` function on the live preview page. Once a second the live preview page checks to see if `keepAlive()` was called within the past 3 seconds (the 3 second test is to account for delays like a large "find in files" operation). If `keepAlive()` hasn't been called in the past 3 seconds, clear any CSS highlights and remove any event listeners that were added. This effectively disables all code that was injected into the page.

This is a bit of a hack, but unfortunately it's necessary since there is no way the live preview page can be notified when the connection has severed.