Skip to content

Commit

Permalink
add option hideCallback, #478
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Apr 6, 2018
1 parent 27a79d0 commit 55048e7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions js/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ define( function( require ) {
closeButtonMargin: 5, // {number} how far away should the close button be from the panel border
closeButtonListener: function() { self.hide(); },

// {function|null} called just before the dialog is hidden, see https://github.com/phetsims/joist/issues/478
hideCallback: null,

// pass through to Panel options
cornerRadius: 10, // {number} radius of the dialog's corners
resize: true, // {boolean} whether to resize if content's size changes
Expand All @@ -77,6 +80,9 @@ define( function( require ) {
// @private (read-only)
this.isModal = options.modal;

// @private
this.hideCallback = options.hideCallback;

// see https://github.com/phetsims/joist/issues/293
assert && assert( this.isModal, 'Non-modal dialogs not currently supported' );

Expand Down Expand Up @@ -271,6 +277,9 @@ define( function( require ) {
*/
hide: function() {
if ( this.isShowing ) {

this.hideCallback && this.hideCallback();

window.phet.joist.sim.hidePopup( this, this.isModal );
this.isShowing = false;

Expand Down

0 comments on commit 55048e7

Please sign in to comment.