diff options
author | fat <fat@folders.local> | 2015-05-14 00:46:50 +0300 |
---|---|---|
committer | fat <fat@folders.local> | 2015-05-14 00:46:50 +0300 |
commit | eaab1def7af7d7e1ab32ff69d043b46e2815ca22 (patch) | |
tree | 495965eef95b6c7e1ca485c04311e6e451695b29 /js/src/carousel.js | |
parent | c2ced2292a6467b9c8a9fec3151982fd7ac8a239 (diff) |
add simple type checker implementation
Diffstat (limited to 'js/src/carousel.js')
-rw-r--r-- | js/src/carousel.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index a4b6da2981..c11f0a599d 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -33,6 +33,14 @@ const Carousel = (($) => { wrap : true } + const DefaultType = { + interval : '(number|boolean)', + keyboard : 'boolean', + slide : '(boolean|string)', + pause : '(string|boolean)', + wrap : 'boolean' + } + const Direction = { NEXT : 'next', PREVIOUS : 'prev' @@ -84,7 +92,7 @@ const Carousel = (($) => { this._isPaused = false this._isSliding = false - this._config = config + this._config = this._getConfig(config) this._element = $(element)[0] this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0] @@ -193,6 +201,12 @@ const Carousel = (($) => { // private + _getConfig(config) { + config = $.extend({}, Default, config) + Util.typeCheckConfig(NAME, config, DefaultType) + return config + } + _addEventListeners() { if (this._config.keyboard) { $(this._element) |