Skip to content

[Help] Trigger exported function #255

Answered by SaschaLucius
SaschaLucius asked this question in Q&A
Discussion options

You must be logged in to vote

Hey,
I found a way to interact with the Component.
I was looking for such an way, and was not realizing that the file where I was defining the story, is also a svelte file, which I can use like all other files.

<script module>
  import { defineMeta } from '@storybook/addon-svelte-csf';
  import Log from '$lib/Log.svelte';

  // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
  const { Story } = defineMeta({
    title: 'Log',
    component: Log,
    tags: ['autodocs']
  });

  let log = undefined;
</script>

<Story name="Default" args={{ }}/>

<Story name="With Interactions" id="interactions">
  <button on:click={() => log.logEvent('Test')}>Log event</button…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

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

Comment options

You must be logged in to vote
0 replies
Answer selected by SaschaLucius
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #254 on December 28, 2024 03:49.