I have a native component with a timer with two functions "start" and "stop". I already have the component working in my form, the problem is that I don´t know how to fire these methods inside the events for example a button click.
Do you know how can I access them?
I tried to expose the start and stop functions using rule helpers as you sugested but it seems that rule helpers are some kind of pre written code that is copied to the editor when you click on them on the context menu. This is not helpful to us because the code inserted this way does not get updated.
For example, lets say that i have 10 buttons across multiple forms using the following rule helper
console.log('tick'); // <-- this is for debugging
And then we notice that somebody forgot to remove that console log, we delete that line from the rule helper. When we run the form again the log is still there because it was copied in every single button that used it, so now we have to look for it in every form and delete it again.
Is there a way to expose component functions so we can do something like timerComponent.start()?
You should be able to call your start method by:
If you have written the native component, you should add rule helpers to enable the rule editor to add the code for you.
In widget.json, setup the rule helpers like this:
Then you can use the code in the rule editor:
If you have no control over the native component to add the helpers, you should be able to call it using Form.getItemFromPath like the sample code in the rule helper, providing the method was added directly as a member function in the code.