Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
dmason30 committed Jul 18, 2023
1 parent 202f636 commit fe50d1a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/js/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 18 additions & 6 deletions resources/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,26 @@ Nova.bootingCallbacks.unshift((app) => {
pollingListener: null,
}),
mounted() {
if (this.$props?.card?.pollingInterval && typeof this.fetch === 'function') {
this.pollingListener = setInterval(() => {
this.fetch();
}, this.$props?.card?.pollingInterval);
}
this.addCardPollingIntervalListener();
},
unmounted() {
clearInterval(this.pollingListener);
this.removeCardPollingIntervalListener();
},
updated() {
this.addCardPollingIntervalListener();
},
methods: {
addCardPollingIntervalListener() {
if (this.$props?.card?.pollingInterval && typeof this.fetch === 'function') {
this.removeCardPollingIntervalListener();
this.pollingListener = setInterval(() => {
this.fetch();
}, this.$props?.card?.pollingInterval);
}
},
removeCardPollingIntervalListener() {
clearInterval(this.pollingListener);
}
}
});
});

0 comments on commit fe50d1a

Please sign in to comment.