diff options
author | Johann-S <johann.servoire@gmail.com> | 2019-09-04 17:58:29 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2020-11-29 21:58:26 +0300 |
commit | 9f6b342dc710e4334b37ded90136efa1127a47cd (patch) | |
tree | cb5d8c8bddf356dd3f8c2289b99e9f9793fba6c7 /js/src/base-component.js | |
parent | c63aebc86ba05f0ebb420add653b80804c6a0cff (diff) |
create a base component
Diffstat (limited to 'js/src/base-component.js')
-rw-r--r-- | js/src/base-component.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/js/src/base-component.js b/js/src/base-component.js new file mode 100644 index 0000000000..a6c7f36bde --- /dev/null +++ b/js/src/base-component.js @@ -0,0 +1,31 @@ +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.0.0-alpha3): base-component.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +import Data from './dom/data' + +class BaseComponent { + constructor(element) { + if (!element) { + return + } + + this._element = element + Data.setData(element, this.constructor.DATA_KEY, this) + } + + /** Static */ + + static getInstance(element) { + return Data.getData(element, this.DATA_KEY) + } + + static get DATA_KEY() { + return null + } +} + +export default BaseComponent |