🐛 api now waits for all connected inputs to have value
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "graphfx",
|
"name": "graphfx",
|
||||||
"version": "0.4.3",
|
"version": "0.4.4",
|
||||||
"description": "Graph image processing pipeline",
|
"description": "Graph image processing pipeline",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export default class Api extends Node<typeof inputs, typeof outputs> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _update() {
|
async _update() {
|
||||||
if (!this.in.url.value) {
|
if (!this.canUpdate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +102,31 @@ export default class Api extends Node<typeof inputs, typeof outputs> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private canUpdate(): boolean {
|
||||||
|
if (!this.in.url.value) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const inputs = [
|
||||||
|
'image0',
|
||||||
|
'image1',
|
||||||
|
'image2',
|
||||||
|
'image3',
|
||||||
|
'image4',
|
||||||
|
'image5',
|
||||||
|
'image6',
|
||||||
|
'image7',
|
||||||
|
]
|
||||||
|
|
||||||
|
for(const input of inputs) {
|
||||||
|
if (this.in[input].output && !this.in[input].value) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private async upload(): Promise<HTMLImageElement | undefined> {
|
private async upload(): Promise<HTMLImageElement | undefined> {
|
||||||
const formData = await this.createFormData();
|
const formData = await this.createFormData();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user