/*!
- 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}) } }