1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-25 04:51:39 +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

18
js/dist/modal.js vendored
View File

@@ -35,6 +35,13 @@ var Modal = (function ($) {
show: true
};
var DefaultType = {
backdrop: '(boolean|string)',
keyboard: 'boolean',
focus: 'boolean',
show: 'boolean'
};
var Event = {
HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY,
@@ -73,7 +80,7 @@ var Modal = (function ($) {
function Modal(element, config) {
_classCallCheck(this, Modal);
this._config = config;
this._config = this._getConfig(config);
this._element = element;
this._dialog = $(element).find(Selector.DIALOG)[0];
this._backdrop = null;
@@ -184,10 +191,17 @@ var Modal = (function ($) {
this._scrollbarWidth = null;
}
}, {
key: '_showElement',
key: '_getConfig',
// private
value: function _getConfig(config) {
config = $.extend({}, Default, config);
Util.typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: '_showElement',
value: function _showElement(relatedTarget) {
var _this2 = this;