Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass async data to the component? #5

Open
mikwee opened this issue Jun 7, 2024 · 0 comments
Open

How to pass async data to the component? #5

mikwee opened this issue Jun 7, 2024 · 0 comments

Comments

@mikwee
Copy link

mikwee commented Jun 7, 2024

I wrote a function that uses fetch() to fetch the necessary information for the audio stream, and put it in an object per the example in the readme. It works when I just call it, but I'm not sure how to pass this object to the component. This:

<script>
 let song = getSong("dMBcOobWD4k");
</script>

<Aplayer audio={song}/>

Does not work. I get a white screen, and this error pops up in the console:

Uncaught TypeError: m2 is undefined
    update svelte-aplayer.es.js:1
    F svelte-aplayer.es.js:1
    svelte_aplayer_es_default svelte-aplayer.es.js:1
    create_fragment App.svelte:26
    init Component.js:148
    App App.svelte:102
    createProxiedComponent svelte-hooks.js:341
    ProxyComponent proxy.js:242
    Proxy<App> proxy.js:349
    <anonymous> main.js:4
svelte-aplayer.es.js:1:29740

I've tried many different thing, incl. async and await. Do you know how to do such a thing?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant