I am currently trying to create two nodes that can call different types of API endpoint given an API description with some semantics. (node1 can access all the user data related stuff, and node2 can access some other endpoints).
The way I am currently doing this, is by using config nodes that contains the API description in general. the two normal nodes have one of these config-node as a property, and can then select one of the endpoints that it exposes depending on the config node selected.
basically, what I want to achieve is:
- you add node1, and double click to configure it.
- you only see one configurable property of type config-node
- you either create a new config-node or choose an existing one
- Based on this selection, a second select box appears and contains the stuff you have access to.
I tries doing this by listening to the onchange event of the input of the config node. however, since node-red automatically replaced the input element with a select element, my event listener disappears and is never called. (when a config node is selected, the function that shows the endpoint selection point is never called)
So my question is:
Is there a way to detect when a config node is selected and call some function when it is?
I'm very grateful for any help!