diff options
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 000000000..a6c7f36bd --- /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 |
