0.0.9 • Published 6 years ago

vue-settimeout v0.0.9

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

/*!

  • Vue-setTimeout
  • (c) 2018 +v
  • Released under the MIT License. / / */

var $setTimeout = function (code, millisec, isSetInterval) { // setTimeout var i = isSetInterval === true ? setInterval(code, millisec) : setTimeout(code, millisec) // in case of beforeDestroy is undefined (if "destroyed" not set, in prod mode) if (!this.$options'destroyed') { this.$options'destroyed' = [] } // add clearTimeout to hook "destroyed" isSetInterval ? this.$options'destroyed'.unshift(function () { // clearInterval on vue component destroy clearInterval(i) }) : this.$options'destroyed'.unshift(function () { // clearTimeout on vue component destroy clearTimeout(i) }) }

export default { install: function (Vue) { Object.defineProperty(Vue.prototype, '$setTimeout', {value: $setTimeout}) } }

0.0.9

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago