Passing data from custom widget to form

Hello, I have a custom widget made with pure javascript and html (no Angular) that manipulates an array of objects that I want to pass on to the form for it to process it and send it to fromOutput.

I have heard other users pass the data used in custom widgets by manipulating the DOM via query selectors, but I have found this method unreliable.

If anyone knows how to, I would greatly appreciate any help.