mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-05-27 14:46:01 +03:00
add simple type checker implementation
This commit is contained in:
+24
-1
@@ -37,7 +37,20 @@ const Tooltip = (($) => {
|
||||
selector : false,
|
||||
placement : 'top',
|
||||
offset : '0 0',
|
||||
constraints : null
|
||||
constraints : []
|
||||
}
|
||||
|
||||
const DefaultType = {
|
||||
animation : 'boolean',
|
||||
template : 'string',
|
||||
title : '(string|function)',
|
||||
trigger : 'string',
|
||||
delay : '(number|object)',
|
||||
html : 'boolean',
|
||||
selector : '(string|boolean)',
|
||||
placement : '(string|function)',
|
||||
offset : 'string',
|
||||
constraints : 'array'
|
||||
}
|
||||
|
||||
const AttachmentMap = {
|
||||
@@ -141,6 +154,10 @@ const Tooltip = (($) => {
|
||||
return EVENT_KEY
|
||||
}
|
||||
|
||||
static get DefaultType() {
|
||||
return DefaultType
|
||||
}
|
||||
|
||||
|
||||
// public
|
||||
|
||||
@@ -544,6 +561,12 @@ const Tooltip = (($) => {
|
||||
}
|
||||
}
|
||||
|
||||
Util.typeCheckConfig(
|
||||
NAME,
|
||||
config,
|
||||
this.constructor.DefaultType
|
||||
)
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user