mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-27 18:24:11 +00:00
[API] Add LLink.resolve static / instance methods (#974)
- `LLink.resolve`: Resolves all IDs on the link to their respective objects (node IDs, slot indexes) - `LinkNetwork.getLink`: a more concise pattern to resolve links
This commit is contained in:
@@ -1174,6 +1174,17 @@ export class LGraph implements LinkNetwork, Serialisable<SerialisableGraph> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the link with the provided ID.
|
||||
* @param id ID of link to find
|
||||
* @returns The link with the provided {@link id}, otherwise `undefined`. Always returns `undefined` if `id` is nullish.
|
||||
*/
|
||||
getLink(id: null | undefined): undefined
|
||||
getLink(id: LinkId | null | undefined): LLink | undefined
|
||||
getLink(id: LinkId | null | undefined): LLink | undefined {
|
||||
return id == null ? undefined : this._links.get(id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reroute by ID, or `undefined` if the ID is `null` or `undefined`.
|
||||
* @param id ID of reroute to return
|
||||
|
||||
Reference in New Issue
Block a user