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 addons: [addonIndexedDB({ enabled: true })],11 // Alternatively12 addons: [addonIndexedDB({ enabled: (room) => room.id === "my-room" })],13});1415// Using @pluv/react1617import { addonIndexedDB } from "@pluv/addon-indexeddb";18import { createBundle, createClient } from "@pluv/react";1920const client = createClient<typeof io>();2122const { createRoomBundle } = createBundle(client);2324const { usePluvRoom } = createRoomBundle({25 addons: [addonIndexedDB({ enabled: true })],26 // Alternatively27 addons: [addonIndexedDB({ enabled: (room) => room.id === "my-room" })],28});