diff --git a/dist/js/index.js b/dist/js/index.js index 9b0abe2..96e62ee 100644 --- a/dist/js/index.js +++ b/dist/js/index.js @@ -1 +1 @@ -Nova.bootingCallbacks.unshift((function(n){n.mixin({data:function(){return{pollingListener:null}},mounted:function(){this.addCardPollingIntervalListener()},unmounted:function(){this.removeCardPollingIntervalListener()},updated:function(){this.addCardPollingIntervalListener()},methods:{addCardPollingIntervalListener:function(){var n,t,i=this;null!==(n=this.$props)&&void 0!==n&&null!==(n=n.card)&&void 0!==n&&n.pollingInterval&&"function"==typeof this.fetch&&(this.removeCardPollingIntervalListener(),this.pollingListener=setInterval((function(){i.fetch()}),null===(t=this.$props)||void 0===t||null===(t=t.card)||void 0===t?void 0:t.pollingInterval))},removeCardPollingIntervalListener:function(){clearInterval(this.pollingListener)}}})})); \ No newline at end of file +Nova.bootingCallbacks.unshift((function(n){n.mixin({data:function(){return{pollingListener:null}},mounted:function(){this.addCardPollingIntervalListener()},unmounted:function(){this.removeCardPollingIntervalListener()},updated:function(){this.addCardPollingIntervalListener()},methods:{addCardPollingIntervalListener:function(){var n;this.removeCardPollingIntervalListener(),null!==(n=this.$props)&&void 0!==n&&null!==(n=n.card)&&void 0!==n&&n.pollingInterval&&"function"==typeof this.fetch&&(this.pollingListener=setInterval(this.fetch,this.$props.card.pollingInterval))},removeCardPollingIntervalListener:function(){clearInterval(this.pollingListener)}}})})); \ No newline at end of file diff --git a/resources/js/index.js b/resources/js/index.js index c924f09..84d546f 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -15,11 +15,9 @@ Nova.bootingCallbacks.unshift((app) => { }, methods: { addCardPollingIntervalListener() { + this.removeCardPollingIntervalListener(); if (this.$props?.card?.pollingInterval && typeof this.fetch === 'function') { - this.removeCardPollingIntervalListener(); - this.pollingListener = setInterval(() => { - this.fetch(); - }, this.$props?.card?.pollingInterval); + this.pollingListener = setInterval(this.fetch, this.$props.card.pollingInterval); } }, removeCardPollingIntervalListener() {