105 typeCheckConfig: function (t, e, n) {
106 for (var i in n)
107 if (Object.prototype.hasOwnProperty.call(n, i)) {
108 var o = n[i], 109 r = e[i], 110 a = 111 r && l.isElement(r) 112 ? "element" 113 : (s = r) === null || typeof s == "undefined" 114 ? "" + s 115 : {}.toString 116 .call(s) 117 .match(/\s([a-z]+)/i)[1] 118 .toLowerCase(); 119 if (!new RegExp(o).test(a))
120 throw new Error(
121 t.toUpperCase() +
4210 if (
4211 (this._element.classList.remove("show"), this._config.animation)
4212 ) {
4213 var n = l.getTransitionDurationFromElement(this._element);4214 i.default(this._element)
4215 .one(l.TRANSITION_END, e)
4216 .emulateTransitionEnd(n);
4165 }),
4166 (e.hide = function () {
4167 if (this._element.classList.contains("show")) {
4168 var t = i.default.Event("hide.bs.toast");4169 i.default(this._element).trigger(t),
4170 t.isDefaultPrevented() || this._close();
4171 }
4156 this._element.classList.add("showing"),
4157 this._config.animation)
4158 ) {
4159 var o = l.getTransitionDurationFromElement(this._element);4160 i.default(this._element)
4161 .one(l.TRANSITION_END, n)
4162 .emulateTransitionEnd(o);
4141 if ((i.default(this._element).trigger(e), !e.isDefaultPrevented())) {
4142 this._clearTimeout(),
4143 this._config.animation && this._element.classList.add("fade");
4144 var n = function () {4145 t._element.classList.remove("showing"),4146 t._element.classList.add("show"),4147 i.default(t._element).trigger("shown.bs.toast"),4148 t._config.autohide &&4149 (t._timeout = setTimeout(function () {4150 t.hide();4151 }, t._config.delay));4152 };4153 if (
4154 (this._element.classList.remove("hide"),
4155 l.reflow(this._element),
Declare variables at the top of their scope as it improves code readability, performance and also helps in code navigation.
The vars-on-top
rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behavior by manually moving the variable declaration to the top of its containing scope.
// Variable declarations in a block:
function doSomething() {
var first;
if (true) {
first = true;
}
var second;
}
// Variable declaration in for initializer:
function doSomething() {
for (var i=0; i<10; i++) {}
}
function doSomething() {
var first;
var second; //multiple declarations are allowed at the top
if (true) {
first = true;
}
}
function doSomething() {
var i;
for (i=0; i<10; i++) {}
}