Ecosystem
Below are some optional packages that work alongside pluv.
@pluv/addon-indexeddb
Use IndexedDB to persist room storage so that when the page is reloaded, the room will load from IndexedDB on the browser. This enables offline editing.
Installation
1npm install @pluv/addon-indexeddb
Usage
1// Using @pluv/client23import { addonIndexedDB } from "@pluv/addon-indexeddb";4import { createClient } from "@pluv/client";5import { type io } from "../server/io";67const client = createClient<typeof io>();89const room = client.createRoom("my-room", {10 // ... other configs here,11 // ...12 addons: [addonIndexedDB({ enabled: true })],13 // Alternatively14 addons: [addonIndexedDB({ enabled: (room) => room.id === "my-room" })],15});1617// Using @pluv/react1819import { addonIndexedDB } from "@pluv/addon-indexeddb";20import { createBundle, createClient } from "@pluv/react";2122const client = createClient<typeof io>();2324const { createRoomBundle } = createBundle(client);2526const { useRoom } = createRoomBundle({27 // ... other configs here,28 // ...29 addons: [addonIndexedDB({ enabled: true })],30 // Alternatively31 addons: [addonIndexedDB({ enabled: (room) => room.id === "my-room" })],32});