vue-awesome-countdown
Advanced tools
Comparing version 1.0.26 to 1.0.28
@@ -157,3 +157,3 @@ module.exports = | ||
// 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=1ef2e215& | ||
// 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& | ||
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)} | ||
@@ -163,3 +163,3 @@ var staticRenderFns = [] | ||
// CONCATENATED MODULE: ./src/vue-awesome-countdown.vue?vue&type=template&id=1ef2e215& | ||
// CONCATENATED MODULE: ./src/vue-awesome-countdown.vue?vue&type=template&id=4c840159& | ||
@@ -235,2 +235,7 @@ // 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& | ||
}, | ||
computed: { | ||
thousandSpeed() { | ||
return this.speed > 0 && this.speed % 1000 === 0 | ||
} | ||
}, | ||
data: function () { | ||
@@ -356,2 +361,7 @@ return { | ||
if(vm.thousandSpeed && org.ms >= 995) { | ||
org.s++ | ||
org.ms = 0 | ||
} | ||
const txt = { | ||
@@ -358,0 +368,0 @@ d: parseInt(org.d, 10).toString(), |
@@ -166,3 +166,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
// 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=1ef2e215& | ||
// 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& | ||
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)} | ||
@@ -172,3 +172,3 @@ var staticRenderFns = [] | ||
// CONCATENATED MODULE: ./src/vue-awesome-countdown.vue?vue&type=template&id=1ef2e215& | ||
// CONCATENATED MODULE: ./src/vue-awesome-countdown.vue?vue&type=template&id=4c840159& | ||
@@ -244,2 +244,7 @@ // 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& | ||
}, | ||
computed: { | ||
thousandSpeed() { | ||
return this.speed > 0 && this.speed % 1000 === 0 | ||
} | ||
}, | ||
data: function () { | ||
@@ -365,2 +370,7 @@ return { | ||
if(vm.thousandSpeed && org.ms >= 995) { | ||
org.s++ | ||
org.ms = 0 | ||
} | ||
const txt = { | ||
@@ -367,0 +377,0 @@ d: parseInt(org.d, 10).toString(), |
@@ -1,2 +0,2 @@ | ||
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["vue-awesome-countdown"]=e():t["vue-awesome-countdown"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({f6fd:function(t,e){(function(t){var e="currentScript",n=t.getElementsByTagName("script");e in t||Object.defineProperty(t,e,{get:function(){try{throw new Error}catch(o){var t,e=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(o.stack)||[!1])[1];for(t in n)if(n[t].src==e||"interactive"==n[t].readyState)return n[t];return null}}})})(document)},fb15:function(t,e,n){"use strict";var o;(n.r(e),"undefined"!==typeof window)&&(n("f6fd"),(o=window.document.currentScript)&&(o=o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=o[1]));var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n(t.tag,t._g(t._b({tag:"components"},"components",t.attrs,!1),t.$listeners),[t._t("prev",null,null,this._self),"beforeStart"===t.state?t._t("before",null,null,this._self):t._e(),"preheat"===t.state?t._t("preheat",null,null,this._self):t._e(),"process"===t.state||"stopped"===t.state||"paused"===t.state?t._t("process",null,null,this._self):t._e(),"finished"===t.state?t._t("finish",null,null,this._self):t._e(),t._t("default",null,null,this._self)],2)},r=[],a={name:"vue-awesome-countdown",props:{startTime:{type:[String,Number,Date],default:null,validator:function(t){return"Invalid Date"!==new Date(t).toString()}},endTime:{type:[String,Number,Date],default:null,validator:function(t){return"Invalid Date"!==new Date(t).toString()}},leftTime:{type:Number,default:0},autoStart:{type:Boolean,default:!0},speed:{type:Number,default:1e3,validator:function(t){return t>=0}},tag:{type:String,default:"span"}},data:function(){return{state:"beforeStart",attrs:{},actualStartTime:null,actualEndTime:null,timeObj:{},countdownTimer:null,runTimes:0,usedTime:0,remainingTime:0}},watch:{speed(t,e){const n=this;if(t<0&&(t=0),t!==e){clearTimeout(n.countdownTimer);const e=(new Date).getTime(),o=Math.floor((e-n.actualStartTime)/t),i=e%t;n.runTimes=o,n.$nextTick(()=>{n.countdownTimer=setTimeout(n.doCountdown,i)})}}},created(){const t=this,e=t.startTime&&new Date(t.startTime).getTime()||0,n=e&&e-(new Date).getTime()||0;t.autoStart&&(t.state="preheat",setTimeout(()=>{t.startCountdown(!0)},n))},methods:{startCountdown(t){const e=this;("beforeStart"===e.state||"stopped"===e.state||"paused"===e.state||t)&&(t&&(Object.assign(e.$data,e.$options.data.call(e)),e.$emit("start",e)),"stopped"===e.state&&(e.remainingTime=e.actualEndTime-(new Date).getTime()),e.actualEndTime||(e.actualEndTime=e.endTime||(new Date).getTime()+(e.remainingTime||e.leftTime)),"paused"===e.state&&(e.actualEndTime=(new Date).getTime()+e.remainingTime),e.state="process",e.doCountdown())},stopCountdown(){const t=this;"process"===t.state&&(clearTimeout(t.countdownTimer),t.$emit("stop",t),t.state="stopped")},pauseCountdown(){const t=this;"process"===t.state&&(clearTimeout(t.countdownTimer),t.remainingTime=t.actualEndTime-(new Date).getTime(),t.$emit("paused",t),t.state="paused")},switchCountdown(){const t=this;return"stopped"===t.state||"beforeStart"===t.state?t.startCountdown():"process"===t.state?t.stopCountdown():void 0},finishCountdown(){const t=this;t.state="finished",t.timeObj={},t.usedTime=(new Date).getTime()-t.actualStartTime,t.$emit("finish",t)},doCountdown(){const t=this;if("process"!==t.state)return;t.actualStartTime||(t.actualStartTime=(new Date).getTime());let e=new Date(t.actualEndTime).getTime()-(new Date).getTime();if(!(e>0))return void t.finishCountdown();{const n={},o=e/1e3,i={d:o/60/60/24,h:o/60/60%24,m:o/60%60,s:o%60,ms:e%1e3},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=t.actualEndTime,n.speed=t.speed,t.usedTime=(new Date).getTime()-t.actualStartTime,n.leftTime=e,t.remainingTime=e,t.timeObj=Object.assign({},n,r,{org:i,ceil:a}),t.timeObj.org=i,t.timeObj.ceil=a,t.$emit("process",t)}let n=t.speed+(t.actualStartTime+t.runTimes++*t.speed-(new Date).getTime());n<0&&(n+=t.speed),t.countdownTimer=setTimeout(t.doCountdown,n)}}},s=a;function u(t,e,n,o,i,r,a,s){var u,d="function"===typeof t?t.options:t;if(e&&(d.render=e,d.staticRenderFns=n,d._compiled=!0),o&&(d.functional=!0),r&&(d._scopeId="data-v-"+r),a?(u=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._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 l=d.render;d.render=function(t,e){return u.call(e),l(t,e)}}else{var c=d.beforeCreate;d.beforeCreate=c?[].concat(c,u):[u]}return{exports:t,options:d}}var d=u(s,i,r,!1,null,null,null),l=d.exports;const c={install:function(t,e){const n=e||"vac";t.component(n,l),t.component("countdown",l)}};"undefined"!==typeof window&&window.Vue&&window.Vue.use(c);var m=c;e["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(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}})})); | ||
//# sourceMappingURL=vue-awesome-countdown.umd.min.js.map |
{ | ||
"name": "vue-awesome-countdown", | ||
"version": "1.0.26", | ||
"version": "1.0.28", | ||
"description": "Vue countdown plugin.", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-awesome-countdown.common.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60844
1048