2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-08 17:22:31 +03:00

implement global dispose method

This commit is contained in:
fat
2015-05-13 12:48:34 -07:00
parent dafdd180cd
commit f8b2569ec8
45 changed files with 976 additions and 439 deletions
+11 -4
View File
@@ -20,6 +20,8 @@ const Alert = (($) => {
const NAME = 'alert'
const VERSION = '4.0.0'
const DATA_KEY = 'bs.alert'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]
const TRANSITION_DURATION = 150
@@ -28,9 +30,9 @@ const Alert = (($) => {
}
const Event = {
CLOSE : 'close.bs.alert',
CLOSED : 'closed.bs.alert',
CLICK : 'click.bs.alert.data-api'
CLOSE : `close${EVENT_KEY}`,
CLOSED : `closed${EVENT_KEY}`,
CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`
}
const ClassName = {
@@ -75,6 +77,11 @@ const Alert = (($) => {
this._removeElement(rootElement)
}
dispose() {
$.removeData(this._element, DATA_KEY)
this._element = null
}
// private
@@ -159,7 +166,7 @@ const Alert = (($) => {
*/
$(document).on(
Event.CLICK,
Event.CLICK_DATA_API,
Selector.DISMISS,
Alert._handleDismiss(new Alert())
)