UNPKG

@geogirafe/lib-geoportal

Version:

GeoGirafe is a flexible application to build online geoportals.

31 lines (30 loc) 1.23 kB
import GirafeSingleton from '../../base/GirafeSingleton.js'; import State from './state.js'; import IGirafeContext from '../context/icontext.js'; export type Callback = (oldValue: any, value: any, parents?: any) => void | Promise<void>; declare class StateManager extends GirafeSingleton { private readonly girafeState; private readonly stateProxy; get state(): State; private readonly callbacks; constructor(context: IGirafeContext); initializeSingleton(): void; private setDefaultValues; /** * Get the language based on the following priority: * 1. user preferences, 2. browser language, 3. app default language */ decideLanguage(): string | null; /** * The fallback language is based on the browser language or app default language */ fallbackLanguage(): string | null; private onChange; subscribe(path: string, callback: Callback): Callback; subscribe(path: RegExp, callback: Callback): Callback; /** Unsubscribe one or multiple trackers by their callbacks. */ unsubscribe(callback: Callback): void; unsubscribe(callbacks: Callback[]): void; batchChanges(statechanges: (state: State) => void): void; } export default StateManager;