/** * -------------------------------------------- * AdminLTE Toasts.js * License MIT * -------------------------------------------- */ import $ from 'jquery' /** * Constants * ==================================================== */ const NAME = 'Toasts' const DATA_KEY = 'lte.toasts' const EVENT_KEY = `.${DATA_KEY}` const JQUERY_NO_CONFLICT = $.fn[NAME] const Event = { INIT: `init${EVENT_KEY}`, CREATED: `created${EVENT_KEY}`, REMOVED: `removed${EVENT_KEY}` } const Selector = { CONTAINER_TOP_RIGHT: '#toastsContainerTopRight', CONTAINER_TOP_LEFT: '#toastsContainerTopLeft', CONTAINER_BOTTOM_RIGHT: '#toastsContainerBottomRight', CONTAINER_BOTTOM_LEFT: '#toastsContainerBottomLeft' } const ClassName = { TOP_RIGHT: 'toasts-top-right', TOP_LEFT: 'toasts-top-left', BOTTOM_RIGHT: 'toasts-bottom-right', BOTTOM_LEFT: 'toasts-bottom-left' } const Position = { TOP_RIGHT: 'topRight', TOP_LEFT: 'topLeft', BOTTOM_RIGHT: 'bottomRight', BOTTOM_LEFT: 'bottomLeft' } const Default = { position: Position.TOP_RIGHT, fixed: true, autohide: false, autoremove: true, delay: 1000, fade: true, icon: null, image: null, imageAlt: null, imageHeight: '25px', title: null, subtitle: null, close: true, body: null, class: null } /** * Class Definition * ==================================================== */ class Toasts { constructor(element, config) { this._config = config this._prepareContainer() $('body').trigger($.Event(Event.INIT)) } // Public create() { const toast = $('