sveltelean Query
Version v0.2.0

Import

import
import { tabs } from '@svelte-lean/query/tabs';

Usage

src/lib/api/modules.ts
// src/lib/api/modules.ts
import { tabs } from '@svelte-lean/query/tabs';
import { session } from '$api/session.svelte';

// Tabs of the same user share one poller and one live connection; another login never hears them.
export const crossTab = tabs({
	session: () => (session.userId === null ? null : String(session.userId))
});

Size

Production Vite builds of a small consumer entry, Svelte external. A marginal row is the bytes the entry adds over the row it names.

BuildOvergzipbrotliBudget (gzip)
tabs (marginal)query3104 B2874 B3500 B

Read from packages/query/artifacts/size.json. Every entry and its method: Performance.

Functions

One module; no call site changes.

Exports

Runtime exports of the entry.

NameTypeDefaultDescription
# tabs (init?: TabsInit) => Module–Cross-tab coordination. Without BroadcastChannel or Web Locks every tab works alone.

Options

TabsInit, the argument of tabs().

TabsInit

All optional.

NameTypeDefaultDescription
# name string'slq'Namespace of the channel and lock names.
# session () => string | null–Reactive partition beside the scope (a user id): tabs of another session never share. null: this tab works alone.
# share number | false16384Largest value (JSON text length) sent with a changed entry; above it the receiving tab refetches. false: never.

Guide

How to use it, with examples: Realtime. All entry points: Svelte Lean Query.