Skip to content

day 12 #1001

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

Merged
merged 1 commit into from
Dec 12, 2024
Merged

day 12 #1001

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions apps/svelte.dev/content/blog/2024-12-01-advent-of-svelte.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ Today we added a whole new module. `svelte/reactivity/window` exports a variety
- [docs](/docs/svelte/svelte-reactivity-window)
- [demo](/playground/8ac86e10fdce485a99c29c95e0092df4?version=5.11.0)

## Day 12
## Day 12: custom type transport in SvelteKit

Coming soon!
A `load` function that runs on the server in your SvelteKit app isn't restricted to returning things that can be serialized as JSON. You can return Maps, Sets, Dates, objects with cyclical references, even Promises, and SvelteKit will handle the serialization on the server and deserialization in the browser.

As of today, you can also return things that _aren't_ built in to the language, such as [classes containing state](/docs/svelte/$state#Classes), or classes returned by your database ORM library, or whatever — just export a `transport` object from your `hooks.js` that provides an `encode` and `decode` function.

- [docs](/docs/kit/hooks#Universal-hooks-transport)
- [demo](https://stackblitz.com/edit/sveltejs-kit-template-default-b5zbxomg?file=src%2Fhooks.js)

## Day 13

Expand Down
Loading