useHandleConnections
當 handle 的連線變更時,可以使用此 Hook 來接收通知。
<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>
簽名
名稱 | 類型 |
---|---|
#參數 |
|
# nodeId | string |
# type | "source" | "target" handle 的類型 |
string handle 的 ID。只有在您有多個相同類型的 handle 時才需要此項。 | |
#回傳值 |
|
可讀取的<Connection[]> 連接到此 handle 的連線的可讀取 store。 |
筆記
- 查看計算流程範例,了解如何使用此 Hook