mirror of
https://github.com/czhu12/canine.git
synced 2025-12-31 00:10:14 -06:00
22 lines
469 B
JavaScript
22 lines
469 B
JavaScript
import { Controller } from "@hotwired/stimulus"
|
|
|
|
export default class extends Controller {
|
|
static values = {
|
|
frequency: Number
|
|
}
|
|
|
|
connect() {
|
|
console.log(this.frequencyValue)
|
|
this.refreshInterval = setInterval(() => {
|
|
console.log("Updating src");
|
|
this.element.setAttribute("src", window.location.href);
|
|
}, this.frequencyValue)
|
|
}
|
|
|
|
disconnect() {
|
|
if (this.refreshInterval) {
|
|
clearInterval(this.refreshInterval)
|
|
}
|
|
}
|
|
}
|