Event for when devtools is open or closed?

795 views
Skip to first unread message

Toby Ho

unread,
May 1, 2013, 10:03:15 PM5/1/13
to chromium-...@chromium.org
Hello all,

I have been successful in getting notification for when an extension dev tools panel created by me is shown or hidden. However, the problem is when the entirety of the dev tools is closed, I am not notified, which leaves me in a weird state on the contentscript side of things. Is it possible to be notified that the user has open or closed dev tools?

Thanks,
Toby

John J Barton

unread,
May 2, 2013, 12:17:01 AM5/2/13
to Toby Ho, Chromium-extensions
how about window.onbeforeunload or unload event handler?
jjb


--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en-US.
For more options, visit https://groups.google.com/a/chromium.org/groups/opt_out.
 
 

Toby Ho

unread,
May 3, 2013, 11:41:57 PM5/3/13
to chromium-...@chromium.org
I figured out how to do this so I'll share it here in case someone else runs into the same problem.

1. I establish a connection between the page in my devtools panel and the event page. To do this you'd use chrome.runtime.onConnect on the event page side and chrome.runtime.connect() on the devtools side, see http://developer.chrome.com/extensions/messaging.html for more.
2. On the event page side, when a connection is made, I listen for port.onDisconnect - one the port is disconnected, I know the devtools panel must have been closed.

Toby
Reply all
Reply to author
Forward
0 new messages