Skip to content

Commit

Permalink
Add getters to LGraph private fields (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Sep 14, 2024
1 parent 0f1b72c commit 4c67692
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions public/litegraph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,13 @@ export declare class LGraph {
private _nodes_in_order: LGraphNode[];
private _version: number;

get nodes(): LGraphNode[];
get groups(): LGraphGroup[];
get nodes_by_id(): Record<number, LGraphNode>;
get nodes_executable(): (LGraphNode & { onExecute: NonNullable<LGraphNode["onExecute"]> }[] | null);
get nodes_in_order(): LGraphNode[];
get version(): number;

getSupportedTypes(): string[];
/** Removes all nodes from this graph */
clear(): void;
Expand Down
25 changes: 25 additions & 0 deletions src/litegraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,31 @@ const globalExport = {};

this.sendActionToCanvas("clear");
}

get nodes() {
return this._nodes;
}

get groups() {
return this._groups;
}

get nodes_by_id() {
return this._nodes_by_id;
}

get nodes_executable() {
return this._nodes_executable;
}

get nodes_in_order() {
return this._nodes_in_order;
}

get version() {
return this._version;
}

/**
* Attach Canvas to this graph
* @method attachCanvas
Expand Down

0 comments on commit 4c67692

Please sign in to comment.