feat: add active node settings

This commit is contained in:
2024-04-23 19:14:27 +02:00
parent 6ea4afa012
commit 198a868fc6
14 changed files with 293 additions and 148 deletions

View File

@@ -5,6 +5,7 @@ import EventEmitter from "./helpers/EventEmitter.js";
import throttle from "./helpers/throttle.js";
import { createLogger } from "./helpers/index.js";
import type { NodeInput } from "@nodes/types";
import { fastHashString } from "@nodes/utils";
const logger = createLogger("graph-manager");
@@ -70,7 +71,13 @@ export class GraphManager extends EventEmitter<{ "save": Graph, "result": any, "
}
private lastSettingsHash = 0;
setSettings(settings: Record<string, unknown>) {
let hash = fastHashString(JSON.stringify(settings));
if (hash === this.lastSettingsHash) return;
this.lastSettingsHash = hash;
this.settings = settings;
this.save();
this.execute();