/*! * Bootstrap base-component.js v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) : typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Base = factory(global.Data, global.EventHandler)); }(this, (function (Data, EventHandler) { 'use strict'; function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data); var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler); /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ const VERSION = '5.0.0'; class BaseComponent { constructor(element) { element = typeof element === 'string' ? document.querySelector(element) : element; if (!element) { return; } this._element = element; Data__default['default'].set(this._element, this.constructor.DATA_KEY, this); } dispose() { Data__default['default'].remove(this._element, this.constructor.DATA_KEY); EventHandler__default['default'].off(this._element, `.${this.constructor.DATA_KEY}`); this._element = null; } /** Static */ static getInstance(element) { return Data__default['default'].get(element, this.DATA_KEY); } static get VERSION() { return VERSION; } } return BaseComponent; }))); //# sourceMappingURL=base-component.js.map