Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101080081
base-component.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 5, 13:18
Size
1 KB
Mime Type
text/x-c++
Expires
Fri, Feb 7, 13:18 (2 d)
Engine
blob
Format
Raw Data
Handle
24079823
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
base-component.js
View Options
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.3): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import
Data
from
'./dom/data'
import
{
executeAfterTransition
,
getElement
}
from
'./util/index'
import
EventHandler
from
'./dom/event-handler'
import
Config
from
'./util/config'
/**
* Constants
*/
const
VERSION
=
'5.2.3'
/**
* Class definition
*/
class
BaseComponent
extends
Config
{
constructor
(
element
,
config
)
{
super
()
element
=
getElement
(
element
)
if
(
!
element
)
{
return
}
this
.
_element
=
element
this
.
_config
=
this
.
_getConfig
(
config
)
Data
.
set
(
this
.
_element
,
this
.
constructor
.
DATA_KEY
,
this
)
}
// Public
dispose
()
{
Data
.
remove
(
this
.
_element
,
this
.
constructor
.
DATA_KEY
)
EventHandler
.
off
(
this
.
_element
,
this
.
constructor
.
EVENT_KEY
)
for
(
const
propertyName
of
Object
.
getOwnPropertyNames
(
this
))
{
this
[
propertyName
]
=
null
}
}
_queueCallback
(
callback
,
element
,
isAnimated
=
true
)
{
executeAfterTransition
(
callback
,
element
,
isAnimated
)
}
_getConfig
(
config
)
{
config
=
this
.
_mergeConfigObj
(
config
,
this
.
_element
)
config
=
this
.
_configAfterMerge
(
config
)
this
.
_typeCheckConfig
(
config
)
return
config
}
// Static
static
getInstance
(
element
)
{
return
Data
.
get
(
getElement
(
element
),
this
.
DATA_KEY
)
}
static
getOrCreateInstance
(
element
,
config
=
{})
{
return
this
.
getInstance
(
element
)
||
new
this
(
element
,
typeof
config
===
'object'
?
config
:
null
)
}
static
get
VERSION
()
{
return
VERSION
}
static
get
DATA_KEY
()
{
return
`
bs
.
$
{
this
.
NAME
}
`
}
static
get
EVENT_KEY
()
{
return
`
.
$
{
this
.
DATA_KEY
}
`
}
static
eventName
(
name
)
{
return
`
$
{
name
}
$
{
this
.
EVENT_KEY
}
`
}
}
export
default
BaseComponent
Event Timeline
Log In to Comment