rename node -> nodes

This commit is contained in:
falsycat 2025-07-13 09:54:29 +09:00
parent e962a6904c
commit b6e37c4d47
7 changed files with 7 additions and 10 deletions

View File

@ -2,24 +2,20 @@ import { Node } from "@xyflow/react";
import Bus from "./Bus";
import { Emitter } from "mitt";
import nodes from "./node/";
import * as nodes from "./nodes/";
export interface Iface {
};
export class Impl implements Iface {
_bus: Bus;
_threads: Set<string>;
constructor(bus: Bus) {
this._bus = bus;
this._threads = new Set();
this._bus = bus;
}
_schedule(node: Node) {
this._threads.add(node.id);
run(this._bus, node).
finally(()=>this._threads.delete(node.id));
run(this._bus, node);
}
};
@ -46,6 +42,7 @@ async function execTask(bus: Bus, node: Node, aborted: Promise<void>) {
const data: nodes.fetch.ToshoListedData = node.data;
data;
const sleep = new Promise(resolve => setTimeout(resolve, 1));
// TODO
await Promise.race([sleep, aborted]);
bus.emit("onNodeRunning", { id: node.id, symbols: ["T/1234"], remaining: 32 });
break;

View File

@ -12,15 +12,15 @@ import {
applyNodeChanges,
applyEdgeChanges,
} from "@xyflow/react";
import * as node from "./node/";
import * as nodes from "./nodes/";
import "@xyflow/react/dist/style.css";
import Bus, { createBus, BusContext, Events } from "./Bus";
const nodeTypes = {
fetch_ToshoListed: node.fetch.ToshoListed,
present_TableDisplay: node.present.TableDisplay,
fetch_ToshoListed: nodes.fetch.ToshoListed,
present_TableDisplay: nodes.present.TableDisplay,
};
const initialNodes: Node[] = [
{