feat: add initial debug node
This commit is contained in:
@@ -15,8 +15,15 @@ export class RemoteNodeRegistry implements NodeRegistry {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private url: string,
|
private url: string,
|
||||||
public cache?: AsyncCache<ArrayBuffer | string>
|
public cache?: AsyncCache<ArrayBuffer | string>,
|
||||||
) {}
|
nodes?: NodeDefinition[]
|
||||||
|
) {
|
||||||
|
if (nodes?.length) {
|
||||||
|
for (const node of nodes) {
|
||||||
|
this.nodes.set(node.id, node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async fetchJson(url: string, skipCache = false) {
|
async fetchJson(url: string, skipCache = false) {
|
||||||
const finalUrl = `${this.url}/${url}`;
|
const finalUrl = `${this.url}/${url}`;
|
||||||
|
|||||||
@@ -32,7 +32,21 @@
|
|||||||
const { data } = $props();
|
const { data } = $props();
|
||||||
|
|
||||||
const registryCache = new IndexDBCache('node-registry');
|
const registryCache = new IndexDBCache('node-registry');
|
||||||
const nodeRegistry = new RemoteNodeRegistry('', registryCache);
|
|
||||||
|
const debugNode = {
|
||||||
|
id: 'max/plantarium/debug',
|
||||||
|
inputs: {
|
||||||
|
a: {
|
||||||
|
type: '*'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
execute(data: Int32Array) {
|
||||||
|
console.log({ data });
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
const nodeRegistry = new RemoteNodeRegistry('', registryCache, [debugNode]);
|
||||||
const workerRuntime = new WorkerRuntimeExecutor();
|
const workerRuntime = new WorkerRuntimeExecutor();
|
||||||
const runtimeCache = new MemoryRuntimeCache();
|
const runtimeCache = new MemoryRuntimeCache();
|
||||||
const memoryRuntime = new MemoryRuntimeExecutor(nodeRegistry, runtimeCache);
|
const memoryRuntime = new MemoryRuntimeExecutor(nodeRegistry, runtimeCache);
|
||||||
|
|||||||
Reference in New Issue
Block a user