mirror of
https://github.com/phfroidmont/scalive.git
synced 2025-12-25 05:26:59 +01:00
Implement subscriptions
This commit is contained in:
parent
08036ab5aa
commit
5da0b64c3e
7 changed files with 103 additions and 45 deletions
|
|
@ -1,9 +1,10 @@
|
|||
import ExampleLiveView.*
|
||||
import monocle.syntax.all.*
|
||||
import scalive.*
|
||||
import zio.*
|
||||
import zio.json.*
|
||||
import zio.stream.ZStream
|
||||
|
||||
import ExampleLiveView.*
|
||||
class ExampleLiveView(someParam: String) extends LiveView[Msg, Model]:
|
||||
|
||||
def init = ZIO.succeed(
|
||||
|
|
@ -65,6 +66,10 @@ class ExampleLiveView(someParam: String) extends LiveView[Msg, Model]:
|
|||
)
|
||||
)
|
||||
)
|
||||
|
||||
def subscriptions(model: Model) =
|
||||
ZStream.tick(1.second).map(_ => Msg.IncCounter).drop(1)
|
||||
|
||||
end ExampleLiveView
|
||||
|
||||
object ExampleLiveView:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue