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

View File

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