Closed absowoot closed 9 months ago
When calling live.handleEvent(), I was receiving the following error: [Cannot read properties of undefined (reading 'handleEvent')]
[Cannot read properties of undefined (reading 'handleEvent')]
After some trial and error, I found that I needed to import and wrap the function with onMount
<script> import { onMount } from "svelte"; onMount(() => { live.handleEvent("my-event", (reply) => {}); }); </script>
Is this intended or a bug? If intended, could you make a note in the readme?
It's intended as it needs to be run on the client. If you're rendering SSR it will throw the error.
I'll add a note in the readme, thanks for reporting
https://github.com/woutdp/live_svelte/commit/baf97ee09afa519902bb4d860376f94f0bef4772
When calling live.handleEvent(), I was receiving the following error:
[Cannot read properties of undefined (reading 'handleEvent')]
After some trial and error, I found that I needed to import and wrap the function with onMount
Is this intended or a bug? If intended, could you make a note in the readme?