Is it possible to trigger an event from Workshop to a custom widget embedded?

A custom widget can trigger an event that propagates to Workshop.

However, is it possible to trigger an Event from Workshop that propagates to the custom widget embedded in Workshop ?

1 Like

There is nothing like the pattern I think this question suggests where a custom widget can register a callback that the host module will call on behalf on the custom widget.

A host module may communicate with an embedded custom widget through variable updates, which the custom widget may implement custom logic to respond to changes in value as they happen.

I’m asking for something simpler than this, similarly to what Slate<>Workshop integration allows, where Slate can listen for events emitted by Workshop.

https://www.palantir.com/docs/foundry/workshop/widgets-iframe#triggerable-events

Like basically - going into a theoritical implementation - can Workshop emits an event using iframe.contentWindow.postMessagefor the child custom widget to capture with, by listening for the event using the window.addEventListener("message", ...) handler.