getState
Returns a plain object with the current values of all store fields. The snapshot isn't reactive - reading it inside a reactive context won't trigger updates. Use getReactiveState() when you need live subscriptions.
Usage
getState(): State
| Field | Type | Description |
|---|---|---|
cards | CardsStore | Internal card storage with CRUD methods |
columns | ColumnConfig[] | Column definitions in board order |
columnAccessor | ColumnAccessor | Resolver for card-to-column membership |
filters | Map<string, FilterPredicate> | Active filter predicates keyed by tag |
sort | SortCriterion | Active sort criterion, or null |
editorData | KanbanCard | null | Currently selected card, or null |
dynamicData | boolean | Whether dynamic loading is enabled |
columnData | Map<ColumnID, { status: ColumnDataStatus }> | Per-column load state ("unknown", "loading", "loaded") |
history | { undo: number; redo: number } | Available undo/redo step counts |
viewData | KanbanModel | Projected render model (filtered, sorted columns with cards) |
Example
<script>
import { Kanban } from "@svar-uisvelte-kanban";
let api;
function logState() {
const state = api.getState();
console.log("columns:", state.columns);
console.log("selected card:", state.editorData);
}
</script>
<Kanban {cards} {columns} bind:this={api} />
<button onclick={logState}>Log state</button>
Related
- getReactiveState — reactive stores for live subscriptions
- getCards — unfiltered source card array
- getStores — raw store instances (escape hatch)