forceCalendar
API Reference

StateManager

API reference for the StateManager class.

import { StateManager } from '@forcecalendar/core';

Constructor

new StateManager(initialState?: Partial<CalendarState>)

Reading State

MethodSignatureReturns
getState() => CalendarStateFrozen state copy
get(key: string) => anyState value

Updating State

MethodSignatureReturns
setState(updates: object | Function) => void
setView(view: string) => void
setCurrentDate(date: Date) => void
navigateNext() => void
navigatePrevious() => void
navigateToday() => void
selectEvent(eventId: string) => void
clearEventSelection() => void
selectDate(date: Date) => void
clearDateSelection() => void
setLoading(loading: boolean, message?: string) => void
setError(error: Error | string | null) => void
updateFilters(filters: object) => void

Subscriptions

MethodSignatureReturns
subscribe(callback: (newState, oldState) => void) => FunctionUnsubscribe
watch(keys: string | string[], callback: Function) => FunctionUnsubscribe

Undo/Redo

MethodSignatureReturns
canUndo() => boolean
canRedo() => boolean
getUndoCount() => number
getRedoCount() => number
undo() => booleanSuccess
redo() => booleanSuccess
reset() => void