Compare commits

...

2 commits

Author SHA1 Message Date
048022c5b0 no intentar usar vite.svg como favicon 2023-03-05 22:16:21 +00:00
aeedc27b00 persistir
fixes #5
2023-03-05 22:15:59 +00:00
4 changed files with 14 additions and 1 deletions

View file

@ -2,7 +2,6 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Schreiben</title> <title>Schreiben</title>
</head> </head>

View file

@ -35,6 +35,7 @@
"nanoid": "^4.0.1", "nanoid": "^4.0.1",
"navaid": "^1.2.0", "navaid": "^1.2.0",
"regexparam": "^2.0.1", "regexparam": "^2.0.1",
"y-indexeddb": "^9.0.9",
"y-prosemirror": "^1.2.0", "y-prosemirror": "^1.2.0",
"y-protocols": "^1.0.5", "y-protocols": "^1.0.5",
"y-webrtc": "^10.2.4", "y-webrtc": "^10.2.4",

View file

@ -24,6 +24,7 @@ specifiers:
tslib: ^2.5.0 tslib: ^2.5.0
typescript: ^4.9.3 typescript: ^4.9.3
vite: ^4.1.0 vite: ^4.1.0
y-indexeddb: ^9.0.9
y-prosemirror: ^1.2.0 y-prosemirror: ^1.2.0
y-protocols: ^1.0.5 y-protocols: ^1.0.5
y-webrtc: ^10.2.4 y-webrtc: ^10.2.4
@ -34,6 +35,7 @@ dependencies:
nanoid: 4.0.1 nanoid: 4.0.1
navaid: 1.2.0 navaid: 1.2.0
regexparam: 2.0.1 regexparam: 2.0.1
y-indexeddb: 9.0.9_yjs@13.5.48
y-prosemirror: 1.2.0_vhy2hiocjqydif5dwvxgfnpihi y-prosemirror: 1.2.0_vhy2hiocjqydif5dwvxgfnpihi
y-protocols: 1.0.5 y-protocols: 1.0.5
y-webrtc: 10.2.4 y-webrtc: 10.2.4
@ -1195,6 +1197,15 @@ packages:
dev: false dev: false
optional: true optional: true
/y-indexeddb/9.0.9_yjs@13.5.48:
resolution: {integrity: sha512-GcJbiJa2eD5hankj46Hea9z4hbDnDjvh1fT62E5SpZRsv8GcEemw34l1hwI2eknGcv5Ih9JfusT37JLx9q3LFg==}
peerDependencies:
yjs: ^13.0.0
dependencies:
lib0: 0.2.63
yjs: 13.5.48
dev: false
/y-prosemirror/1.2.0_vhy2hiocjqydif5dwvxgfnpihi: /y-prosemirror/1.2.0_vhy2hiocjqydif5dwvxgfnpihi:
resolution: {integrity: sha512-t3uxuX4HIkb1GNt8jV+dplRbNH2OmQD/BNeCCbjLD3Mq0o6JEXxHedv58ZIPFDE6ma24jljlL+u8pGvN6B37XQ==} resolution: {integrity: sha512-t3uxuX4HIkb1GNt8jV+dplRbNH2OmQD/BNeCCbjLD3Mq0o6JEXxHedv58ZIPFDE6ma24jljlL+u8pGvN6B37XQ==}
peerDependencies: peerDependencies:

View file

@ -1,5 +1,6 @@
import * as Y from "yjs"; import * as Y from "yjs";
import { WebrtcProvider } from "y-webrtc"; import { WebrtcProvider } from "y-webrtc";
import { IndexeddbPersistence } from "y-indexeddb";
import { nanoid } from "nanoid"; import { nanoid } from "nanoid";
export type WorldIdentifier = { export type WorldIdentifier = {
@ -34,6 +35,7 @@ export function getWorldY(world: WorldIdentifier): WorldY {
"wss://y-webrtc-signaling-us.herokuapp.com", "wss://y-webrtc-signaling-us.herokuapp.com",
], ],
}); });
const idbProvider = new IndexeddbPersistence(world.room, ydoc);
const worldY = { ydoc, webrtcProvider: provider }; const worldY = { ydoc, webrtcProvider: provider };
worldYCache[world.room] = worldY; worldYCache[world.room] = worldY;
return worldY; return worldY;