You have to get data, somehow . . .
You might as well use this pattern.
There’s a lot to be said for an established pattern. I’ve tried, over the years, to establish a pattern that is straightforward, repeatable, and clear.
So I’ve settled on the idea of, in the initial load of the widget, to push the data into the WV at the same time the widget itself is loaded. Here are my steps:
1. Go get the data.
2. Actually get the data.
3. Send the data into the Web Viewer.
4. Process the data in the WV for use.
This pattern is clear and repeatable. Most of the steps can be copied from one project to another.
Try this out. We talk about this and other JS-in-FM topics every week in #Office Hours , and this pattern is well explained in the #JS in FM course.
How do you get the data? Let’s discuss in the comments below.