Refresh timers when morphing happens
This commit is contained in:
@@ -24,6 +24,14 @@ export default class extends Controller {
|
||||
clearInterval(this.#timer)
|
||||
}
|
||||
|
||||
refreshAll() {
|
||||
this.constructor.targets.forEach(targetName => {
|
||||
this.targets.findAll(targetName).forEach(target => {
|
||||
this.#formatTime(this[`${targetName}Formatter`], target)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
timeTargetConnected(target) {
|
||||
this.#formatTime(this.timeFormatter, target)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||
</head>
|
||||
|
||||
<body data-controller="lightbox local-time timezone-cookie">
|
||||
<body data-controller="lightbox local-time timezone-cookie" data-action="turbo:morph@window->local-time#refreshAll">
|
||||
<header id="header">
|
||||
<a href="#main-content" class="skip-navigation btn">Skip to main content</a>
|
||||
<%= yield :header %>
|
||||
|
||||
Reference in New Issue
Block a user