Closed bluepuma77 closed 9 months ago
Yeah I agree the transform thing is too much just to convert stuff to json.
It should be easy to achieve, I'll take a look at it tomorrow, Idk if I'll manage to implement it then.
I'll try to get it done by Sunday though.
Thanks for the suggestion!
Got basics to work, maybe a little info in README.md
is enough to help devs with JSON:
<script>
import { source } from 'sveltekit-sse'
const json = source('/custom-event')
let obj = {}
$: if ($json) { obj = JSON.parse($json || {}) }
</script>
{JSON.stringify(obj}
Thanks. I will check for sourceJSON()
but feel free to just close this issue if you like.
Hi @bluepuma77 , I just released v0.6.0 with a live json parsing feature.
You can read more about it in the Json section on the home page.
I also added this section which is relevant to the json parsing feature.
Let me know if you encounter any other issues.
The default library seems very easy to use with strings on the client side:
I would be great to have an additional simple
sourceJSON()
to get JSON objects on the client side, that's probably a very standard use case for developers:The whole
Transform
looks a bit too complicated when just using JSON.