Skip to content

Commit

Permalink
Tidying up comments
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmith00000 committed Mar 31, 2024
1 parent b36ba6b commit 78532fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions tyrian/js/src/main/scala/tyrian/runtime/Renderer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ object Renderer:
Renderer(vnode, RendererState.Idle, 0, 0)
)

// Renderer is stored here (and pointlessly, atm, in a Ref), because the
// render function is a callback and I can't return values back to the
// initiating call site under this arrangement
@SuppressWarnings(Array("scalafix:DisableSyntax.var", "scalafix:DisableSyntax.null"))
var renderer: Renderer = null
val timeout: Long = 1000
Expand All @@ -29,8 +32,6 @@ object Renderer:
onMsg: Msg => Unit,
router: Location => Msg
)(t: Long): Unit =
// t is the running time, last triggered is the epoch. What to do?
// println(s"render $t - ${renderer.lastTriggered} >= $timeout = ${t - renderer.lastTriggered > 2000}")
if t - renderer.lastTriggered >= timeout then
renderer = renderer.copy(
state = RendererState.Idle,
Expand All @@ -55,7 +56,7 @@ object Renderer:
onMsg: Msg => Unit,
router: Location => Msg
): Renderer =
// Sadly, need to do a null check for now.
// Sadly, needs a null check for as long as I'm using a var to hold the state.
if renderer == null then renderer = r

renderer.state match
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object TyrianRuntime:

_ <- runCmd(cmdsAndSubs._1) *> runSub(cmdsAndSubs._2)
m <- model.get
_ <- renderer.update(r => Renderer.redraw(r, m, view, onMsg, router)) // Renderer update not needed...
_ <- renderer.update(r => Renderer.redraw(r, m, view, onMsg, router))
} yield ()
}.foreverM

Expand Down

0 comments on commit 78532fe

Please sign in to comment.