useVisuallyJsUpdate
useVisuallyJsUpdate(
callback):void
Simple hook that responds to all update events in the model, including when the model is cleared. You pass in a function that takes the model as argument, and that should be invoked when an update/clear event occurs. The function is also invoked when the initial model reference is obtained.
<script>
import { useVisuallyJsUpdate } from "@visuallyjs/browser-ui-svelte"
let count = $state(0)
useVisuallyJsUpdate((model) => count = model.getNodeCount())
</script>
<h1>{count}</h1>
Parameters
callback
(model) => any
Callback to invoke when an update occurs.
Returns
void