useHandleConnections
Source on GitHub (opens in a new tab)
This hook can be used to get notified when the connections of a handle change.
<script lang="ts">
import { useHandleConnections } from '@xyflow/svelte';
const connections = useHandleConnections({ nodeId: 'node-id', type: 'target' });
$: {
// This will be called whenever connections change
// for the target handle in the node with id 'node-id'
console.log($connections);
}
</script>
Signature
Name | Type |
---|---|
#Params |
|
# nodeId | string |
# type | "source" | "target" The type of the handle |
string The id of the handle. This is only necessary if you have multiple handles of the same type. | |
#Returns |
|
A readable store of the connections that are connected to this handle. |
Notes
- Check the Computing Flows example to see how this hook can be used