Skip to main content

useVisuallyJsUpdate

useVisuallyJsUpdate(callback): void

Simple composable 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 setup>
import { useVisuallyJsUpdate } from "@visuallyjs/browser-ui-vue"
import { ref } from "vue"

const count = ref(0)
useVisuallyJsUpdate((model) => count.value = model.getNodeCount())
</script>

<template>
<h1>{{ count }}</h1>
</template>

Parameters

callback

(model) => any

Callback to invoke when an update occurs.

Returns

void