1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-26 06:44:35 +02:00

add simple type checker implementation

This commit is contained in:
fat
2015-05-13 14:46:50 -07:00
parent c2ced2292a
commit eaab1def7a
25 changed files with 258 additions and 28 deletions

View File

@@ -33,6 +33,13 @@ const Modal = (($) => {
show : true
}
const DefaultType = {
backdrop : '(boolean|string)',
keyboard : 'boolean',
focus : 'boolean',
show : 'boolean'
}
const Event = {
HIDE   : `hide${EVENT_KEY}`,
HIDDEN   : `hidden${EVENT_KEY}`,
@@ -71,7 +78,7 @@ const Modal = (($) => {
class Modal {
constructor(element, config) {
this._config = config
this._config = this._getConfig(config)
this._element = element
this._dialog = $(element).find(Selector.DIALOG)[0]
this._backdrop = null
@@ -198,6 +205,12 @@ const Modal = (($) => {
// private
_getConfig(config) {
config = $.extend({}, Default, config)
Util.typeCheckConfig(NAME, config, DefaultType)
return config
}
_showElement(relatedTarget) {
let transition = Util.supportsTransitionEnd() &&
$(this._element).hasClass(ClassName.FADE)