Ability to be closed programmatically

This commit is contained in:
斟酌 鵬兄 2016-02-22 03:09:07 +08:00
parent d8736696db
commit 15844c9f0c
2 changed files with 11 additions and 7 deletions

View File

@ -55,6 +55,14 @@
_self.stage = null; _self.stage = null;
}; };
this.close = function( confirmed )
{
doc.removeEventListener( keyBinding );
if( _self.clickHandler ) _self.clickHandler( confirmed );
document.body.removeChild( _self.stage );
_self.stage = null;
};
if ( no ) if ( no )
{ {
var _no = Dand.wrap( var _no = Dand.wrap(
@ -63,13 +71,7 @@
, Dand.wrap( "span", null, "comp flsf", no ) , Dand.wrap( "span", null, "comp flsf", no )
); );
_no.onclick = function() _no.onclick = this.close;
{
doc.removeEventListener( keyBinding );
if( _self.clickHandler ) _self.clickHandler( false );
document.body.removeChild( _self.stage );
_self.stage = null;
};
} }
// set handler // set handler

View File

@ -5,3 +5,5 @@ Components.MessageBox = function() {};
Components.MessageBox.setHandler; Components.MessageBox.setHandler;
/** @type {Function} */ /** @type {Function} */
Components.MessageBox.show; Components.MessageBox.show;
/** @type {Function} */
Components.MessageBox.close;