6 ms·
I am just looking at this but quick question. Is there an example for building a local-first app? Also, I working with plain vanilla HTML & JS and Alpine. Can t
by santa_boy 2y ago
I am just looking at this but quick question. Is there an example for building a local-first app? Also, I working with plain vanilla HTML & JS and Alpine. Can this be used in my apps?
- deleted 2y ago[deleted]
- paulgb 2y agoY-sweet (which this is built with) allows you to make a Yjs app local-first by passing “offlineSupport” to the provider when constructing. There’s a demo of this here: https://demos.y-sweet.dev/color-grid https://demos.y-sweet.dev/color-grid The source for that demo is here: https://github.com/jamsocket/y-sweet/blob/5fa6941cf5568f4a3fba9047da59a69c10d68167/examples/nextjs/src/app/(demos)/color-grid/page.tsx#L9 https://github.com/jamsocket/y-sweet/blob/5fa6941cf5568f4a3f... That demo uses react, but there is a vanilla js version of the same demo here: https://github.com/jamsocket/y-sweet/tree/main/examples/vanilla https://github.com/jamsocket/y-sweet/tree/main/examples/vani... (The vanilla js version is not local first, but it would just be a matter of passing the same offlineSupport flag to make it so.)
- santa_boy 2y agoThank you. This is the direction I needed. Will try out
- steve_adams_86 2y agoI just noticed that if you install the example service after setting up an account, it installs a version of @y-sweet/react which doesn't offer the offlineSupport prop. The version specified is ^0.5.1. After switching to 0.7.1 as the repo you linked uses, all is well. Probably not a big deal for most newcomers, but it might be worth updating dependencies in the example service.
- paulgb 2y agoThanks Steve, good catch!