Skip to content

Commit 14871fc

Browse files
authored
day 12 (#1001)
1 parent a8cff16 commit 14871fc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

apps/svelte.dev/content/blog/2024-12-01-advent-of-svelte.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,14 @@ Today we added a whole new module. `svelte/reactivity/window` exports a variety
9090
- [docs](/docs/svelte/svelte-reactivity-window)
9191
- [demo](/playground/8ac86e10fdce485a99c29c95e0092df4?version=5.11.0)
9292

93-
## Day 12
93+
## Day 12: custom type transport in SvelteKit
9494

95-
Coming soon!
95+
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.
96+
97+
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.
98+
99+
- [docs](/docs/kit/hooks#Universal-hooks-transport)
100+
- [demo](https://stackblitz.com/edit/sveltejs-kit-template-default-b5zbxomg?file=src%2Fhooks.js)
96101

97102
## Day 13
98103

0 commit comments

Comments
 (0)