`ComposeScene` has the `hasInvalidations` function...
# compose-desktop
j
ComposeScene
has the
hasInvalidations
function, which I currently check periodically. Is there a way to setup a callback which will be executed if this value changes to true?
i
ComposeScene
has
invalidate
callback in its constructor, which will be called, when ComposeScene should be rerendered
👍 1
j
And how can I make sure that calling
scene.render(canvas, System.nanoTime())
inside that
invalidate
callback does not lead to concurrency issues?
i
You shouldn't call
render
in it. You should schedule a new frame inside your rendering loop,
render
should be called inside it. See the example
j
I assume that in this example
GlfwCoroutineDispatcher()
(and using that for the
FrameDispatcher
) is the important part, because it is only single threaded, am I right?
i
Yes, it is important that it is single threaded. It is mostly for `LaunchedEffect`'s, which can't perform in parallel with ComposeScene methods. Sorry, it is not true, `LaunchedEffect`'s theoretically can launch in parallel. It also used for other things, like recompositions, and scheduling callbacks.