Skip to main content

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.

import { useVisuallyJsUpdate } from "@visuallyjs/browser-ui-angular"

@Component({
...
})
export class MyComponent {
constructor() {
useVisuallyJsUpdate((model) => console.log("Model updated", model.getNodeCount()))
}
}

Parameters

callback

(model) => any

Callback to invoke when an update occurs.

Returns

void