Ompa
Ompa2mo ago

Using custom components in an app

Anyone have any experience with making custom components? I am wondering what is common practice when making exchanging info between the component and a script? Currently i am setting the output of the component to my "question" then a background script sees a change in the output and runs with that new output from the component. In the script that branches out to all those actions thats needed. Is there some easier way? I will give an example so its easier to undestand. Lets say i want a component to look up adresses. By default the component is in its search state, then by writing into a searchfield it will set an output and a background script will run with those perameters, eg {"action": "search_query", "query": "abc"}. the script will then do some things and will return something like {"action": "search_suggestion", "suggestions": [x, y, z]}, this will then trigger a recalculation of the component and it will see those perameters and rerender itself. This will go on in a "loop", back and forth where everything is stateless. I am wondering if there is an easier approach? Do people use APIs? In that case how, and can you use background scripts in an app for that? Any help is appreciated.
2 Replies
Ompa
OmpaOP4w ago
@rubenf, do you have any input?
rubenf
rubenf4w ago
@Ompa custom components work by having a single input and a single output and you have to do everything around that. It's not as flexible as normal components but it will work. We're working on having full code apps which should improve the experience

Did you find this page helpful?