Reloading/resetting a webdialog widget

Hi Everyone!
Need a little help with reloading/resetting webdialogs.
So I have a webdialog as a widget . It currently shows some basic info like a jquery meter and total face counts and measurements.
I need this widget to update itself when I load a new skp file or when I switch between active windows to show relevant information for the active windows.

Is there anyway to achieve this?
Thanks for any response or clues.

You’d have to use observers to monitor when models are being opened/created. Then from the observer call your webdialog with the info it needs to update the content.

AppObserver
http://www.sketchup.com/intl/en/developer/docs/ourdoc/appobserver

And for the Mac the it’s recent onActivateModel callback:
http://www.sketchup.com/intl/en/developer/docs/ourdoc/appobserver#onActivateModel
works with v2015 and higher only