@shopmacher/flash
Advanced tools
Comparing version 1.0.0-beta.6 to 1.0.0
@@ -44,2 +44,4 @@ (function (global, factory) { | ||
function Flash($root) { | ||
var _this = this; | ||
_classCallCheck(this, Flash); | ||
@@ -61,4 +63,6 @@ | ||
if (!Number.isNaN(hideAfter)) { | ||
setTimeout(this.hide.bind(this), hideAfter); | ||
if (!isNaN(hideAfter)) { | ||
window.addEventListener('load', function () { | ||
setTimeout(_this.hide.bind(_this), hideAfter); | ||
}); | ||
} else { | ||
@@ -81,6 +85,6 @@ throw new TypeError("data-hide-after has to be of type number, but has value '".concat(hideAfter, "'")); | ||
value: function show() { | ||
var _this = this; | ||
var _this2 = this; | ||
window.requestAnimationFrame(function () { | ||
_this.$root.classList.add('visible'); | ||
_this2.$root.classList.add('visible'); | ||
}); | ||
@@ -95,6 +99,6 @@ } | ||
value: function hide() { | ||
var _this2 = this; | ||
var _this3 = this; | ||
window.requestAnimationFrame(function () { | ||
_this2.$root.classList.remove('visible'); | ||
_this3.$root.classList.remove('visible'); | ||
}); | ||
@@ -101,0 +105,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.SmFlash=t()}(this,function(){"use strict";function e(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(){function t(e){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.$root=e,"true"===this.$root.getAttribute("data-closable")){var i=document.createElement("div");i.classList.add("close-icon"),this.$root.appendChild(i),i.addEventListener("click",this.hide.bind(this))}if(this.$root.getAttribute("data-hide-after")){var n=parseInt(this.$root.getAttribute("data-hide-after"),10);if(Number.isNaN(n))throw new TypeError("data-hide-after has to be of type number, but has value '".concat(n,"'"));setTimeout(this.hide.bind(this),n)}this.$root.addEventListener("show",this.show.bind(this)),this.$root.addEventListener("hide",this.hide.bind(this)),this.show()}var i,n,r;return i=t,r=[{key:"init",value:function(){var e=document.querySelectorAll(".sm-flash");return Array.prototype.map.call(e,function(e){return new t(e)})}},{key:"create",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.createElement("div");n.classList.add("sm-flash");var r=document.createElement("div");return r.classList.add("inner-wrapper"),r.innerHTML=e,n.appendChild(r),i.closable&&n.setAttribute("data-closable","true"),i.hideAfter&&n.setAttribute("data-hide-after",""+i.hideAfter),i.appendTo instanceof HTMLElement&&i.appendTo.appendChild(n),new t(n)}}],(n=[{key:"show",value:function(){var e=this;window.requestAnimationFrame(function(){e.$root.classList.add("visible")})}},{key:"hide",value:function(){var e=this;window.requestAnimationFrame(function(){e.$root.classList.remove("visible")})}},{key:"getRef",value:function(){return this.$root}}])&&e(i.prototype,n),r&&e(i,r),t}()}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.SmFlash=t()}(this,function(){"use strict";function e(e,t){for(var i=0;t.length>i;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(){function t(e){var i=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.$root=e,"true"===this.$root.getAttribute("data-closable")){var n=document.createElement("div");n.classList.add("close-icon"),this.$root.appendChild(n),n.addEventListener("click",this.hide.bind(this))}if(this.$root.getAttribute("data-hide-after")){var a=parseInt(this.$root.getAttribute("data-hide-after"),10);if(isNaN(a))throw new TypeError("data-hide-after has to be of type number, but has value '".concat(a,"'"));window.addEventListener("load",function(){setTimeout(i.hide.bind(i),a)})}this.$root.addEventListener("show",this.show.bind(this)),this.$root.addEventListener("hide",this.hide.bind(this)),this.show()}var i,n,a;return i=t,a=[{key:"init",value:function(){var e=document.querySelectorAll(".sm-flash");return Array.prototype.map.call(e,function(e){return new t(e)})}},{key:"create",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.createElement("div");n.classList.add("sm-flash");var a=document.createElement("div");return a.classList.add("inner-wrapper"),a.innerHTML=e,n.appendChild(a),i.closable&&n.setAttribute("data-closable","true"),i.hideAfter&&n.setAttribute("data-hide-after",""+i.hideAfter),i.appendTo instanceof HTMLElement&&i.appendTo.appendChild(n),new t(n)}}],(n=[{key:"show",value:function(){var e=this;window.requestAnimationFrame(function(){e.$root.classList.add("visible")})}},{key:"hide",value:function(){var e=this;window.requestAnimationFrame(function(){e.$root.classList.remove("visible")})}},{key:"getRef",value:function(){return this.$root}}])&&e(i.prototype,n),a&&e(i,a),t}()}); | ||
//# sourceMappingURL=sm-flash.min.js.map |
@@ -38,2 +38,4 @@ function _classCallCheck(instance, Constructor) { | ||
function Flash($root) { | ||
var _this = this; | ||
_classCallCheck(this, Flash); | ||
@@ -55,4 +57,6 @@ | ||
if (!Number.isNaN(hideAfter)) { | ||
setTimeout(this.hide.bind(this), hideAfter); | ||
if (!isNaN(hideAfter)) { | ||
window.addEventListener('load', function () { | ||
setTimeout(_this.hide.bind(_this), hideAfter); | ||
}); | ||
} else { | ||
@@ -75,6 +79,6 @@ throw new TypeError("data-hide-after has to be of type number, but has value '".concat(hideAfter, "'")); | ||
value: function show() { | ||
var _this = this; | ||
var _this2 = this; | ||
window.requestAnimationFrame(function () { | ||
_this.$root.classList.add('visible'); | ||
_this2.$root.classList.add('visible'); | ||
}); | ||
@@ -89,6 +93,6 @@ } | ||
value: function hide() { | ||
var _this2 = this; | ||
var _this3 = this; | ||
window.requestAnimationFrame(function () { | ||
_this2.$root.classList.remove('visible'); | ||
_this3.$root.classList.remove('visible'); | ||
}); | ||
@@ -95,0 +99,0 @@ } |
@@ -40,2 +40,4 @@ 'use strict'; | ||
function Flash($root) { | ||
var _this = this; | ||
_classCallCheck(this, Flash); | ||
@@ -57,4 +59,6 @@ | ||
if (!Number.isNaN(hideAfter)) { | ||
setTimeout(this.hide.bind(this), hideAfter); | ||
if (!isNaN(hideAfter)) { | ||
window.addEventListener('load', function () { | ||
setTimeout(_this.hide.bind(_this), hideAfter); | ||
}); | ||
} else { | ||
@@ -77,6 +81,6 @@ throw new TypeError("data-hide-after has to be of type number, but has value '".concat(hideAfter, "'")); | ||
value: function show() { | ||
var _this = this; | ||
var _this2 = this; | ||
window.requestAnimationFrame(function () { | ||
_this.$root.classList.add('visible'); | ||
_this2.$root.classList.add('visible'); | ||
}); | ||
@@ -91,6 +95,6 @@ } | ||
value: function hide() { | ||
var _this2 = this; | ||
var _this3 = this; | ||
window.requestAnimationFrame(function () { | ||
_this2.$root.classList.remove('visible'); | ||
_this3.$root.classList.remove('visible'); | ||
}); | ||
@@ -97,0 +101,0 @@ } |
{ | ||
"name": "@shopmacher/flash", | ||
"version": "1.0.0-beta.6", | ||
"version": "1.0.0", | ||
"description": "Library for displaying flash/toast messages", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -31,4 +31,6 @@ /** | ||
if (!Number.isNaN(hideAfter)) { | ||
setTimeout(this.hide.bind(this), hideAfter); | ||
if (!isNaN(hideAfter)) { | ||
window.addEventListener('load', () => { | ||
setTimeout(this.hide.bind(this), hideAfter); | ||
}); | ||
} else { | ||
@@ -35,0 +37,0 @@ throw new TypeError( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
57615
880
1
0