svelte-firebase-state
Firebase utilities for Svelte 5.
Svelte Playground ->NodeListState manages a specific node in the Realtime Database, supporting fetching, live updates, and saving changes with optional autosave.
Quick example:
demo
Parameters:
required
database Database
The firebase database instance.
required
path string | ((currentUser: User | null) => string)
The path to the node in the database.
optional
auth Auth
The firebase auth instance.
optional
listen boolean
default = false
Listen for real-time updates.
Properties:
data Data[] | null | undefined
Reactive state that holds the list, the node data.
The data is undefined when loading.
The data is null when the node could not be found.
Methods:
refetch () => Promise<Data>
Re-fetch the data.
add (data: Data) => Promise<DatabaseReference>
Add a new node to the list.
More examples:
Listen to a list (array) for a chat
demo