Skip to content

Callback props #1634

Answered by ovidiuch
mwilliamson asked this question in Q&A
Apr 18, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi @mwilliamson,

There's no specific functionality in Cosmos for handling callback events. I generally just log stuff in the browser console.

You could build something generic that can be reused across fixtures in two ways:

  • Create a decorator that exposes a callback for handling an action via context that can be used inside fixtures. The decorator can render the action pane globally but it will be renderered inside the preview iframe.
  • If you want to venture into something more ambitious you can create a plugin like you said and add a pane in the Cosmos UI. You can store the actions with useFixtureState into fixture state that can be read by a Cosmos UI plugin.

Let me know if you have ot…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mwilliamson
Comment options

Answer selected by mwilliamson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants