3 ms·
I'm not sure I understand what you want, but... If want you want is a generic way to interface with a bunch of small tools that take some parameters and output
by genezeta 2y ago
I'm not sure I understand what you want, but... If want you want is a generic way to interface with a bunch of small tools that take some parameters and output some file, read on. If not, sorry.
One thing you might do is abstract over something like dat.GUI [0]
(Note: I like dat.GUI but understand it hasn't seen development lately and you might be concerned about that. In that case, substitute dat.GUI for Tweakpane [1] and the idea is still the same)
dat.GUI creates a sort of control panel with various types of inputs based on whatever you want to manipulate. Something like this [2].
The code to produce it can be abstracted quite nicely. So you could simply create a small generic script to create a panel from just a JS object with the properties you want to manipulate. You'd link this to a simple submit against your server-side binary.
Now, the only thing that remains is presenting the output. I'm guessing that today you're generating an image but in some other case your output may be a text file or something else. For a lot of things you can just relay on the browser if you output to an <iframe> and let the browser sort it. In most cases it will display it and when not, it could offer to download & save with the correct headers.
[0] https://github.com/dataarts/dat.gui https://github.com/dataarts/dat.gui
[1] https://tweakpane.github.io/docs/ https://tweakpane.github.io/docs/
[2] https://imgur.com/a/em4qKl7 https://imgur.com/a/em4qKl7