mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-24 16:29:45 +00:00
Typescript conversion 0.7.84 (#194)
* Convert litegraph.js to TS
* Overhaul static litegraph.d.ts with updated types
* Fix rename oversights and revert fix unused param
- Some functions were broken by merging updated TS function signatures which included param renames
- Removal of unused params does not belong in the TS conversion PR, and has been reverted
* Remove legacy static .d.ts file
* Add callback decl from #180
Support allowing links to widgets (#180)
c23e610c11
* Convert NodeId to string | number
Results in significantly less downstream changes, despite being a change from the old static file.
---------
Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
This commit is contained in:
25
src/LLink.ts
25
src/LLink.ts
@@ -1,7 +1,23 @@
|
||||
// @ts-nocheck
|
||||
//this is the class in charge of storing link information
|
||||
import type { ISlotType } from "./interfaces"
|
||||
import type { NodeId } from "./LGraphNode"
|
||||
|
||||
export type LinkId = number | string
|
||||
|
||||
export type SerialisedLLinkArray = [LinkId, NodeId, number, NodeId, number, ISlotType]
|
||||
|
||||
//this is the class in charge of storing link information
|
||||
export class LLink {
|
||||
id?: LinkId
|
||||
type?: ISlotType
|
||||
origin_id?: NodeId
|
||||
origin_slot?: number
|
||||
target_id?: NodeId
|
||||
target_slot?: number
|
||||
data?: number | string | boolean | { toToolTip?(): string }
|
||||
_data?: unknown
|
||||
_pos: Float32Array
|
||||
_last_time?: number
|
||||
|
||||
constructor(id, type, origin_id, origin_slot, target_id, target_slot) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
@@ -13,6 +29,8 @@ export class LLink {
|
||||
this._data = null;
|
||||
this._pos = new Float32Array(2); //center
|
||||
}
|
||||
|
||||
// configure(o: LLink | SerialisedLLinkArray) {
|
||||
configure(o) {
|
||||
if (o.constructor === Array) {
|
||||
this.id = o[0];
|
||||
@@ -30,7 +48,8 @@ export class LLink {
|
||||
this.target_slot = o.target_slot;
|
||||
}
|
||||
}
|
||||
serialize() {
|
||||
|
||||
serialize(): SerialisedLLinkArray {
|
||||
return [
|
||||
this.id,
|
||||
this.origin_id,
|
||||
|
||||
Reference in New Issue
Block a user