Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-awesome-countdown

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-awesome-countdown - npm Package Compare versions

Comparing version 1.0.28 to 1.1.0

142

dist/vue-awesome-countdown.common.js

@@ -85,3 +85,3 @@ module.exports =

/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
/******/ return __webpack_require__(__webpack_require__.s = "9896");
/******/ })

@@ -91,46 +91,88 @@ /************************************************************************/

/***/ "f6fd":
/***/ (function(module, exports) {
/***/ "79e4":
/***/ (function(module, exports, __webpack_require__) {
// document.currentScript polyfill by Adam Miller
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller
// MIT license
// source: https://github.com/amiller-gh/currentScript-polyfill
(function(document){
var currentScript = "currentScript",
scripts = document.getElementsByTagName('script'); // Live NodeList collection
// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505
// If browser needs currentScript polyfill, add get currentScript() to the document object
if (!(currentScript in document)) {
Object.defineProperty(document, currentScript, {
get: function(){
(function (root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}(typeof self !== 'undefined' ? self : this, function () {
function getCurrentScript () {
var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')
// for chrome
if (!descriptor && 'currentScript' in document && document.currentScript) {
return document.currentScript
}
// IE 6-10 supports script readyState
// IE 10+ support stack trace
try { throw new Error(); }
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
// Specifically works with the format of stack traces in IE.
var i, res = ((/.*at [^\(]*\((.*):.+:.+\)$/ig).exec(err.stack) || [false])[1];
// For all scripts on the page, if src matches or if ready state is interactive, return the script tag
for(i in scripts){
if(scripts[i].src == res || scripts[i].readyState == "interactive"){
return scripts[i];
}
}
// If no match, return null
return null;
// for other browsers with native support for currentScript
if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {
return document.currentScript
}
// IE 8-10 support script readyState
// IE 11+ & Firefox support stack trace
try {
throw new Error();
}
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
scriptLocation = (stackDetails && stackDetails[1]) || false,
line = (stackDetails && stackDetails[2]) || false,
currentLocation = document.location.href.replace(document.location.hash, ''),
pageSource,
inlineScriptSourceRegExp,
inlineScriptSource,
scripts = document.getElementsByTagName('script'); // Live NodeList collection
if (scriptLocation === currentLocation) {
pageSource = document.documentElement.outerHTML;
inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
}
for (var i = 0; i < scripts.length; i++) {
// If ready state is interactive, return the script tag
if (scripts[i].readyState === 'interactive') {
return scripts[i];
}
// If src matches, return the script tag
if (scripts[i].src === scriptLocation) {
return scripts[i];
}
// If inline source matches, return the script tag
if (
scriptLocation === currentLocation &&
scripts[i].innerHTML &&
scripts[i].innerHTML.trim() === inlineScriptSource
) {
return scripts[i];
}
}
});
}
})(document);
// If no match, return null
return null;
}
};
return getCurrentScript
}));
/***/ }),
/***/ "fb15":
/***/ "9896":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

@@ -142,13 +184,20 @@

// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
// CONCATENATED MODULE: ./node_modules/_@vue_cli-service@4.4.6@@vue/cli-service/lib/commands/build/setPublicPath.js
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
var currentScript = window.document.currentScript
if (true) {
__webpack_require__("f6fd")
var getCurrentScript = __webpack_require__("79e4")
currentScript = getCurrentScript()
// for backward compatibility, because previously we directly included the polyfill
if (!('currentScript' in document)) {
Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
}
}
var i
if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
__webpack_require__.p = i[1] // eslint-disable-line
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
if (src) {
__webpack_require__.p = src[1] // eslint-disable-line
}

@@ -160,3 +209,3 @@ }

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7f3c921e-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/vue-awesome-countdown.vue?vue&type=template&id=4c840159&
// CONCATENATED MODULE: ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"883de7d0-vue-loader-template"}!./node_modules/_vue-loader@15.9.3@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options!./src/vue-awesome-countdown.vue?vue&type=template&id=4c840159&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.tag,_vm._g(_vm._b({tag:"components"},'components',_vm.attrs,false),_vm.$listeners),[_vm._t("prev",null,null,this._self),(_vm.state === 'beforeStart')?_vm._t("before",null,null,this._self):_vm._e(),(_vm.state === 'preheat')?_vm._t("preheat",null,null,this._self):_vm._e(),(_vm.state === 'process' || _vm.state === 'stopped' || _vm.state === 'paused')?_vm._t("process",null,null,this._self):_vm._e(),(_vm.state === 'finished')?_vm._t("finish",null,null,this._self):_vm._e(),_vm._t("default",null,null,this._self)],2)}

@@ -168,3 +217,3 @@ var staticRenderFns = []

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/vue-awesome-countdown.vue?vue&type=script&lang=js&
// CONCATENATED MODULE: ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options!./src/vue-awesome-countdown.vue?vue&type=script&lang=js&
//

@@ -419,3 +468,3 @@ //

/* harmony default export */ var src_vue_awesome_countdownvue_type_script_lang_js_ = (vue_awesome_countdownvue_type_script_lang_js_);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
// CONCATENATED MODULE: ./node_modules/_vue-loader@15.9.3@vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */

@@ -485,3 +534,8 @@

hook = shadowMode
? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles

@@ -552,3 +606,3 @@ }

/* harmony default export */ var src_vue_awesome_countdown = (vac);
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
// CONCATENATED MODULE: ./node_modules/_@vue_cli-service@4.4.6@@vue/cli-service/lib/commands/build/entry-lib.js

@@ -555,0 +609,0 @@

@@ -94,3 +94,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
/******/ return __webpack_require__(__webpack_require__.s = "9896");
/******/ })

@@ -100,46 +100,88 @@ /************************************************************************/

/***/ "f6fd":
/***/ (function(module, exports) {
/***/ "79e4":
/***/ (function(module, exports, __webpack_require__) {
// document.currentScript polyfill by Adam Miller
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller
// MIT license
// source: https://github.com/amiller-gh/currentScript-polyfill
(function(document){
var currentScript = "currentScript",
scripts = document.getElementsByTagName('script'); // Live NodeList collection
// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505
// If browser needs currentScript polyfill, add get currentScript() to the document object
if (!(currentScript in document)) {
Object.defineProperty(document, currentScript, {
get: function(){
(function (root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}(typeof self !== 'undefined' ? self : this, function () {
function getCurrentScript () {
var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')
// for chrome
if (!descriptor && 'currentScript' in document && document.currentScript) {
return document.currentScript
}
// IE 6-10 supports script readyState
// IE 10+ support stack trace
try { throw new Error(); }
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
// Specifically works with the format of stack traces in IE.
var i, res = ((/.*at [^\(]*\((.*):.+:.+\)$/ig).exec(err.stack) || [false])[1];
// For all scripts on the page, if src matches or if ready state is interactive, return the script tag
for(i in scripts){
if(scripts[i].src == res || scripts[i].readyState == "interactive"){
return scripts[i];
}
}
// If no match, return null
return null;
// for other browsers with native support for currentScript
if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {
return document.currentScript
}
// IE 8-10 support script readyState
// IE 11+ & Firefox support stack trace
try {
throw new Error();
}
catch (err) {
// Find the second match for the "at" string to get file src url from stack.
var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
scriptLocation = (stackDetails && stackDetails[1]) || false,
line = (stackDetails && stackDetails[2]) || false,
currentLocation = document.location.href.replace(document.location.hash, ''),
pageSource,
inlineScriptSourceRegExp,
inlineScriptSource,
scripts = document.getElementsByTagName('script'); // Live NodeList collection
if (scriptLocation === currentLocation) {
pageSource = document.documentElement.outerHTML;
inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
}
for (var i = 0; i < scripts.length; i++) {
// If ready state is interactive, return the script tag
if (scripts[i].readyState === 'interactive') {
return scripts[i];
}
// If src matches, return the script tag
if (scripts[i].src === scriptLocation) {
return scripts[i];
}
// If inline source matches, return the script tag
if (
scriptLocation === currentLocation &&
scripts[i].innerHTML &&
scripts[i].innerHTML.trim() === inlineScriptSource
) {
return scripts[i];
}
}
});
}
})(document);
// If no match, return null
return null;
}
};
return getCurrentScript
}));
/***/ }),
/***/ "fb15":
/***/ "9896":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

@@ -151,13 +193,20 @@

// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
// CONCATENATED MODULE: ./node_modules/_@vue_cli-service@4.4.6@@vue/cli-service/lib/commands/build/setPublicPath.js
// This file is imported into lib/wc client bundles.
if (typeof window !== 'undefined') {
var currentScript = window.document.currentScript
if (true) {
__webpack_require__("f6fd")
var getCurrentScript = __webpack_require__("79e4")
currentScript = getCurrentScript()
// for backward compatibility, because previously we directly included the polyfill
if (!('currentScript' in document)) {
Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
}
}
var i
if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
__webpack_require__.p = i[1] // eslint-disable-line
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
if (src) {
__webpack_require__.p = src[1] // eslint-disable-line
}

@@ -169,3 +218,3 @@ }

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7f3c921e-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/vue-awesome-countdown.vue?vue&type=template&id=4c840159&
// CONCATENATED MODULE: ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"883de7d0-vue-loader-template"}!./node_modules/_vue-loader@15.9.3@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options!./src/vue-awesome-countdown.vue?vue&type=template&id=4c840159&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.tag,_vm._g(_vm._b({tag:"components"},'components',_vm.attrs,false),_vm.$listeners),[_vm._t("prev",null,null,this._self),(_vm.state === 'beforeStart')?_vm._t("before",null,null,this._self):_vm._e(),(_vm.state === 'preheat')?_vm._t("preheat",null,null,this._self):_vm._e(),(_vm.state === 'process' || _vm.state === 'stopped' || _vm.state === 'paused')?_vm._t("process",null,null,this._self):_vm._e(),(_vm.state === 'finished')?_vm._t("finish",null,null,this._self):_vm._e(),_vm._t("default",null,null,this._self)],2)}

@@ -177,3 +226,3 @@ var staticRenderFns = []

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/vue-awesome-countdown.vue?vue&type=script&lang=js&
// CONCATENATED MODULE: ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options!./src/vue-awesome-countdown.vue?vue&type=script&lang=js&
//

@@ -428,3 +477,3 @@ //

/* harmony default export */ var src_vue_awesome_countdownvue_type_script_lang_js_ = (vue_awesome_countdownvue_type_script_lang_js_);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
// CONCATENATED MODULE: ./node_modules/_vue-loader@15.9.3@vue-loader/lib/runtime/componentNormalizer.js
/* globals __VUE_SSR_CONTEXT__ */

@@ -494,3 +543,8 @@

hook = shadowMode
? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles

@@ -561,3 +615,3 @@ }

/* harmony default export */ var src_vue_awesome_countdown = (vac);
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
// CONCATENATED MODULE: ./node_modules/_@vue_cli-service@4.4.6@@vue/cli-service/lib/commands/build/entry-lib.js

@@ -564,0 +618,0 @@

@@ -1,2 +0,2 @@

(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["vue-awesome-countdown"]=t():e["vue-awesome-countdown"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({f6fd:function(e,t){(function(e){var t="currentScript",n=e.getElementsByTagName("script");t in e||Object.defineProperty(e,t,{get:function(){try{throw new Error}catch(o){var e,t=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(o.stack)||[!1])[1];for(e in n)if(n[e].src==t||"interactive"==n[e].readyState)return n[e];return null}}})})(document)},fb15:function(e,t,n){"use strict";var o;(n.r(t),"undefined"!==typeof window)&&(n("f6fd"),(o=window.document.currentScript)&&(o=o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=o[1]));var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n(e.tag,e._g(e._b({tag:"components"},"components",e.attrs,!1),e.$listeners),[e._t("prev",null,null,this._self),"beforeStart"===e.state?e._t("before",null,null,this._self):e._e(),"preheat"===e.state?e._t("preheat",null,null,this._self):e._e(),"process"===e.state||"stopped"===e.state||"paused"===e.state?e._t("process",null,null,this._self):e._e(),"finished"===e.state?e._t("finish",null,null,this._self):e._e(),e._t("default",null,null,this._self)],2)},r=[],a={name:"vue-awesome-countdown",props:{startTime:{type:[String,Number,Date],default:null,validator:function(e){return"Invalid Date"!==new Date(e).toString()}},endTime:{type:[String,Number,Date],default:null,validator:function(e){return"Invalid Date"!==new Date(e).toString()}},leftTime:{type:Number,default:0},autoStart:{type:Boolean,default:!0},speed:{type:Number,default:1e3,validator:function(e){return e>=0}},tag:{type:String,default:"span"}},computed:{thousandSpeed(){return this.speed>0&&this.speed%1e3===0}},data:function(){return{state:"beforeStart",attrs:{},actualStartTime:null,actualEndTime:null,timeObj:{},countdownTimer:null,runTimes:0,usedTime:0,remainingTime:0}},watch:{speed(e,t){const n=this;if(e<0&&(e=0),e!==t){clearTimeout(n.countdownTimer);const t=(new Date).getTime(),o=Math.floor((t-n.actualStartTime)/e),i=t%e;n.runTimes=o,n.$nextTick(()=>{n.countdownTimer=setTimeout(n.doCountdown,i)})}}},created(){const e=this,t=e.startTime&&new Date(e.startTime).getTime()||0,n=t&&t-(new Date).getTime()||0;e.autoStart&&(e.state="preheat",setTimeout(()=>{e.startCountdown(!0)},n))},methods:{startCountdown(e){const t=this;("beforeStart"===t.state||"stopped"===t.state||"paused"===t.state||e)&&(e&&(Object.assign(t.$data,t.$options.data.call(t)),t.$emit("start",t)),"stopped"===t.state&&(t.remainingTime=t.actualEndTime-(new Date).getTime()),t.actualEndTime||(t.actualEndTime=t.endTime||(new Date).getTime()+(t.remainingTime||t.leftTime)),"paused"===t.state&&(t.actualEndTime=(new Date).getTime()+t.remainingTime),t.state="process",t.doCountdown())},stopCountdown(){const e=this;"process"===e.state&&(clearTimeout(e.countdownTimer),e.$emit("stop",e),e.state="stopped")},pauseCountdown(){const e=this;"process"===e.state&&(clearTimeout(e.countdownTimer),e.remainingTime=e.actualEndTime-(new Date).getTime(),e.$emit("paused",e),e.state="paused")},switchCountdown(){const e=this;return"stopped"===e.state||"beforeStart"===e.state?e.startCountdown():"process"===e.state?e.stopCountdown():void 0},finishCountdown(){const e=this;e.state="finished",e.timeObj={},e.usedTime=(new Date).getTime()-e.actualStartTime,e.$emit("finish",e)},doCountdown(){const e=this;if("process"!==e.state)return;e.actualStartTime||(e.actualStartTime=(new Date).getTime());let t=new Date(e.actualEndTime).getTime()-(new Date).getTime();if(!(t>0))return void e.finishCountdown();{const n={},o=t/1e3,i={d:o/60/60/24,h:o/60/60%24,m:o/60%60,s:o%60,ms:t%1e3};e.thousandSpeed&&i.ms>=995&&(i.s++,i.ms=0);const r={d:parseInt(i.d,10).toString(),h:parseInt(i.h,10).toString().padStart(2,0),m:parseInt(i.m,10).toString().padStart(2,0),s:parseInt(i.s,10).toString().padStart(2,0),ms:i.ms.toString().padStart(3,0)},a={d:parseInt(Math.ceil(o/60/60/24),10),h:parseInt(Math.ceil(o/60/60),10),m:parseInt(Math.ceil(o/60),10),s:parseInt(Math.ceil(o),10)};n.endTime=e.actualEndTime,n.speed=e.speed,e.usedTime=(new Date).getTime()-e.actualStartTime,n.leftTime=t,e.remainingTime=t,e.timeObj=Object.assign({},n,r,{org:i,ceil:a}),e.timeObj.org=i,e.timeObj.ceil=a,e.$emit("process",e)}let n=e.speed+(e.actualStartTime+e.runTimes++*e.speed-(new Date).getTime());n<0&&(n+=e.speed),e.countdownTimer=setTimeout(e.doCountdown,n)}}},s=a;function u(e,t,n,o,i,r,a,s){var u,d="function"===typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=n,d._compiled=!0),o&&(d.functional=!0),r&&(d._scopeId="data-v-"+r),a?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},d._ssrRegister=u):i&&(u=s?function(){i.call(this,this.$root.$options.shadowRoot)}:i),u)if(d.functional){d._injectStyles=u;var c=d.render;d.render=function(e,t){return u.call(t),c(e,t)}}else{var l=d.beforeCreate;d.beforeCreate=l?[].concat(l,u):[u]}return{exports:e,options:d}}var d=u(s,i,r,!1,null,null,null),c=d.exports;const l={install:function(e,t){const n=t||"vac";e.component(n,c),e.component("countdown",c)}};"undefined"!==typeof window&&window.Vue&&window.Vue.use(l);var m=l;t["default"]=m}})}));
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["vue-awesome-countdown"]=t():e["vue-awesome-countdown"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="9896")}({"79e4":function(e,t,n){var r,o,i;(function(n,a){o=[],r=a,i="function"===typeof r?r.apply(t,o):r,void 0===i||(e.exports=i)})("undefined"!==typeof self&&self,(function(){function e(){var t=Object.getOwnPropertyDescriptor(document,"currentScript");if(!t&&"currentScript"in document&&document.currentScript)return document.currentScript;if(t&&t.get!==e&&document.currentScript)return document.currentScript;try{throw new Error}catch(m){var n,r,o,i=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,a=/@([^@]*):(\d+):(\d+)\s*$/gi,s=i.exec(m.stack)||a.exec(m.stack),u=s&&s[1]||!1,c=s&&s[2]||!1,d=document.location.href.replace(document.location.hash,""),l=document.getElementsByTagName("script");u===d&&(n=document.documentElement.outerHTML,r=new RegExp("(?:[^\\n]+?\\n){0,"+(c-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),o=n.replace(r,"$1").trim());for(var p=0;p<l.length;p++){if("interactive"===l[p].readyState)return l[p];if(l[p].src===u)return l[p];if(u===d&&l[p].innerHTML&&l[p].innerHTML.trim()===o)return l[p]}return null}}return e}))},9896:function(e,t,n){"use strict";if(n.r(t),"undefined"!==typeof window){var r=window.document.currentScript,o=n("79e4");r=o(),"currentScript"in document||Object.defineProperty(document,"currentScript",{get:o});var i=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n(e.tag,e._g(e._b({tag:"components"},"components",e.attrs,!1),e.$listeners),[e._t("prev",null,null,this._self),"beforeStart"===e.state?e._t("before",null,null,this._self):e._e(),"preheat"===e.state?e._t("preheat",null,null,this._self):e._e(),"process"===e.state||"stopped"===e.state||"paused"===e.state?e._t("process",null,null,this._self):e._e(),"finished"===e.state?e._t("finish",null,null,this._self):e._e(),e._t("default",null,null,this._self)],2)},s=[],u={name:"vue-awesome-countdown",props:{startTime:{type:[String,Number,Date],default:null,validator:function(e){return"Invalid Date"!==new Date(e).toString()}},endTime:{type:[String,Number,Date],default:null,validator:function(e){return"Invalid Date"!==new Date(e).toString()}},leftTime:{type:Number,default:0},autoStart:{type:Boolean,default:!0},speed:{type:Number,default:1e3,validator:function(e){return e>=0}},tag:{type:String,default:"span"}},computed:{thousandSpeed(){return this.speed>0&&this.speed%1e3===0}},data:function(){return{state:"beforeStart",attrs:{},actualStartTime:null,actualEndTime:null,timeObj:{},countdownTimer:null,runTimes:0,usedTime:0,remainingTime:0}},watch:{speed(e,t){const n=this;if(e<0&&(e=0),e!==t){clearTimeout(n.countdownTimer);const t=(new Date).getTime(),r=Math.floor((t-n.actualStartTime)/e),o=t%e;n.runTimes=r,n.$nextTick(()=>{n.countdownTimer=setTimeout(n.doCountdown,o)})}}},created(){const e=this,t=e.startTime&&new Date(e.startTime).getTime()||0,n=t&&t-(new Date).getTime()||0;e.autoStart&&(e.state="preheat",setTimeout(()=>{e.startCountdown(!0)},n))},methods:{startCountdown(e){const t=this;("beforeStart"===t.state||"stopped"===t.state||"paused"===t.state||e)&&(e&&(Object.assign(t.$data,t.$options.data.call(t)),t.$emit("start",t)),"stopped"===t.state&&(t.remainingTime=t.actualEndTime-(new Date).getTime()),t.actualEndTime||(t.actualEndTime=t.endTime||(new Date).getTime()+(t.remainingTime||t.leftTime)),"paused"===t.state&&(t.actualEndTime=(new Date).getTime()+t.remainingTime),t.state="process",t.doCountdown())},stopCountdown(){const e=this;"process"===e.state&&(clearTimeout(e.countdownTimer),e.$emit("stop",e),e.state="stopped")},pauseCountdown(){const e=this;"process"===e.state&&(clearTimeout(e.countdownTimer),e.remainingTime=e.actualEndTime-(new Date).getTime(),e.$emit("paused",e),e.state="paused")},switchCountdown(){const e=this;return"stopped"===e.state||"beforeStart"===e.state?e.startCountdown():"process"===e.state?e.stopCountdown():void 0},finishCountdown(){const e=this;e.state="finished",e.timeObj={},e.usedTime=(new Date).getTime()-e.actualStartTime,e.$emit("finish",e)},doCountdown(){const e=this;if("process"!==e.state)return;e.actualStartTime||(e.actualStartTime=(new Date).getTime());let t=new Date(e.actualEndTime).getTime()-(new Date).getTime();if(!(t>0))return void e.finishCountdown();{const n={},r=t/1e3,o={d:r/60/60/24,h:r/60/60%24,m:r/60%60,s:r%60,ms:t%1e3};e.thousandSpeed&&o.ms>=995&&(o.s++,o.ms=0);const i={d:parseInt(o.d,10).toString(),h:parseInt(o.h,10).toString().padStart(2,0),m:parseInt(o.m,10).toString().padStart(2,0),s:parseInt(o.s,10).toString().padStart(2,0),ms:o.ms.toString().padStart(3,0)},a={d:parseInt(Math.ceil(r/60/60/24),10),h:parseInt(Math.ceil(r/60/60),10),m:parseInt(Math.ceil(r/60),10),s:parseInt(Math.ceil(r),10)};n.endTime=e.actualEndTime,n.speed=e.speed,e.usedTime=(new Date).getTime()-e.actualStartTime,n.leftTime=t,e.remainingTime=t,e.timeObj=Object.assign({},n,i,{org:o,ceil:a}),e.timeObj.org=o,e.timeObj.ceil=a,e.$emit("process",e)}let n=e.speed+(e.actualStartTime+e.runTimes++*e.speed-(new Date).getTime());n<0&&(n+=e.speed),e.countdownTimer=setTimeout(e.doCountdown,n)}}},c=u;function d(e,t,n,r,o,i,a,s){var u,c="function"===typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),r&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),a?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},c._ssrRegister=u):o&&(u=s?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),u)if(c.functional){c._injectStyles=u;var d=c.render;c.render=function(e,t){return u.call(t),d(e,t)}}else{var l=c.beforeCreate;c.beforeCreate=l?[].concat(l,u):[u]}return{exports:e,options:c}}var l=d(c,a,s,!1,null,null,null),p=l.exports;const m={install:function(e,t){const n=t||"vac";e.component(n,p),e.component("countdown",p)}};"undefined"!==typeof window&&window.Vue&&window.Vue.use(m);var f=m;t["default"]=f}})}));
//# sourceMappingURL=vue-awesome-countdown.umd.min.js.map
{
"name": "vue-awesome-countdown",
"version": "1.0.28",
"version": "1.1.0",
"description": "Vue countdown plugin.",

@@ -14,3 +14,4 @@ "main": "dist/vue-awesome-countdown.common.js",

"build": "vue-cli-service build --target lib --name vue-awesome-countdown src/vue-awesome-countdown.js",
"prepare": "npm run build"
"prepare": "npm run build",
"release": "release-it"
},

@@ -17,0 +18,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc