リファレンスフック

useHandleConnections

GitHub上のソース

このフックは、ハンドルの接続が変更されたときに通知を受け取るために使用できます。

<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"
ハンドルのタイプ
#id(任意)
string
ハンドルのID。これは、同じタイプのハンドルが複数ある場合にのみ必要です。
#戻り値
読み取り可能<Connection[]>
このハンドルに接続されている接続の読み取り可能なストア。

注釈