How to use runClientActions() events?

Can someone explain the purpose of this function and provide an example of how to use it?


I am familiar with using the fireComponentEvent method, but I am unsure about how to use the runClientActions() method.

It's the inverse of fireComponentEvents.
If you have business logic or a custom script method or something on the backend, you can fire a message over the bus and catch it on the frontend in order to do something in your component.

This was wrong; there's other patterns to do this more directly.

3 Likes

Now I know this is the inverse of fireComponentEvents. Can anyone give me an example with code?

Actually... I don't think you ever really need to worry about or implement it yourself. I think it's more of an internal plumbing mechanism.

Thanks, Paul. At this moment, Just for learning purposes only. :grinning: :grinning:

1 Like

So, if you implement ComponentStoreDelegate you'll notice there's fireEvent and handleEvent methods; those are basically what I was thinking about when I mentioned the backend and frontend sending events to and fro.

The runClientActions hook appears to only be called if you have actions (as in, these guys: Component Events and Actions - Ignition User Manual 8.1 - Ignition Documentation) that will be run on the "client" (the actual frontend browser session) but the gateway needs to invoke those, for whatever reason. As far as I can tell from the code, that's only potentially going to happen during component startup and shutdown?

1 Like