diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..375e40c5 Binary files /dev/null and b/.DS_Store differ diff --git a/src/viewer.js b/src/viewer.js index d963bf14..a564814b 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -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(); }, /**