Added event for viewer destroy

This commit is contained in:
Tom 2022-11-23 15:28:40 -05:00
parent d7cd12679c
commit 29384cd5ff
2 changed files with 13 additions and 1 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -756,6 +756,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
* viewer = null; //important
*
* @function
* @fires OpenSeadragon.Viewer.event:destroy
*/
destroy: function( ) {
if ( !THIS[ this.hash ] ) {
@ -795,7 +796,6 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
this.navigator = null;
}
this.removeAllHandlers();
if (this.buttonGroup) {
this.buttonGroup.destroy();
@ -841,6 +841,18 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
// clear our reference to the main element - they will need to pass it in again, creating a new viewer
this.element = null;
/**
* Raised when the viewer is destroyed (see {@link OpenSeadragon.Viewer#destroy}).
*
* @event destroy
* @memberof OpenSeadragon.Viewer
* @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
this.raiseEvent( 'destroy' );
this.removeAllHandlers();
},
/**