diff options
author | GeoSot <geo.sotis@gmail.com> | 2021-12-10 19:18:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 19:18:18 +0300 |
commit | 886b940796b3595a03b44230ca8b78197c5ee1c5 (patch) | |
tree | 6b37d0208ae9fd9816e052572ab3496095cc88b6 /js/src/toast.js | |
parent | 68f226750db03bc26ed5ead6bb074804a4f63853 (diff) |
Extract Component config functionality to a separate class (#33872)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Diffstat (limited to 'js/src/toast.js')
-rw-r--r-- | js/src/toast.js | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/js/src/toast.js b/js/src/toast.js index ba376d05ed..b85e20b605 100644 --- a/js/src/toast.js +++ b/js/src/toast.js @@ -5,9 +5,8 @@ * -------------------------------------------------------------------------- */ -import { defineJQueryPlugin, reflow, typeCheckConfig } from './util/index' +import { defineJQueryPlugin, reflow } from './util/index' import EventHandler from './dom/event-handler' -import Manipulator from './dom/manipulator' import BaseComponent from './base-component' import { enableDismissTrigger } from './util/component-functions' @@ -51,9 +50,8 @@ const Default = { class Toast extends BaseComponent { constructor(element, config) { - super(element) + super(element, config) - this._config = this._getConfig(config) this._timeout = null this._hasMouseInteraction = false this._hasKeyboardInteraction = false @@ -61,14 +59,14 @@ class Toast extends BaseComponent { } // Getters - static get DefaultType() { - return DefaultType - } - static get Default() { return Default } + static get DefaultType() { + return DefaultType + } + static get NAME() { return NAME } @@ -133,17 +131,6 @@ class Toast extends BaseComponent { } // Private - _getConfig(config) { - config = { - ...Default, - ...Manipulator.getDataAttributes(this._element), - ...(typeof config === 'object' && config ? config : {}) - } - - typeCheckConfig(NAME, config, this.constructor.DefaultType) - - return config - } _maybeScheduleHide() { if (!this._config.autohide) { |