reference:scripting_reference:scripting_events:onviewerevent

The OnViewerEvent event can be implemented by a script add-in to receive notification whenever certain events occur in the standalone image viewer. One possible use would be a script that automatically displays a floating toolbar whenever a standalone viewer is active, and hides it again when the window goes inactive or closes. 

Method Name: OnViewerEvent

Argument Type:

ViewerEventData 

Return Type:

none

Description:

The ViewerEventData.viewer property identifies the Viewer that the event occurred in. The event property returns a string identifying the event that occurred, and if applicable the item property identifies the Item involved.