Interface ApplicationState
clear(): void;
current(extra?: object): ApplicationStateData;
get(options: {
name: string;
}): ApplicationStateData;
keys(): IterableIterator<string, any, any>;
remove(options: {
name: string;
}): ApplicationStateData;
restore(options: {
animateTo?: boolean;
duration?: number;
ease?: EasingReference;
name: string;
remove?: boolean;
}): ApplicationStateData;
save(options: {
extra?: any[];
name: string;
}): ApplicationStateData;
set(data: ApplicationStateData, options?: {
animateTo?: boolean;
async?: boolean;
duration?: number;
ease?: EasingReference;
}): void;
}
Methods
clear
current
- current(extra?): ApplicationStateData
Returns current application state along with any extra data passed into method.
Parameters
Optional
extra: objectExtra data to add to application state.
Returns ApplicationStateData
Passed in object with current application state.
get
- get(options): ApplicationStateData
Gets any saved application state by name.
Parameters
- options: {
name: string;
}Options.
name: string
Saved data set name.
Returns ApplicationStateData
Any saved application state.
- options: {
keys
- keys(): IterableIterator<string, any, any>
Returns IterableIterator<string, any, any>
The saved application state names / keys.
remove
- remove(options): ApplicationStateData
Removes and returns any saved application state by name.
Parameters
- options: {
name: string;
}Options.
name: string
Name to remove and retrieve.
Returns ApplicationStateData
Any saved application state.
- options: {
restore
- restore(options): ApplicationStateData
Restores a previously saved application state by
name
returning the data. Several optional parameters are available to animate / tween to the new state. WhenanimateTo
is true an animation is scheduled via AnimationAPI.to and the duration and easing name or function may be specified.Parameters
- options: {
animateTo?: boolean;
duration?: number;
ease?: EasingReference;
name: string;
remove?: boolean;
}Parameters
Optional
animateTo ?: booleanAnimate to restore data.
Optional
duration?: numberDuration in seconds.
Optional
ease?: EasingReferenceEasing function name or function.
name: string
Saved data set name.
Optional
remove?: booleanRemove data set.
Returns ApplicationStateData
Any saved application state.
- options: {
save
- save(options): ApplicationStateData
Saves current application state with the opportunity to add extra data to the saved state.
Parameters
- options: {
extra?: any[];
name: string;
}Options.
Optional
extra?: any[]Extra data to add to saved state.
name: string
Name to index this saved state.
Returns ApplicationStateData
Current saved application state.
- options: {
set
- set(data, options?): void
Sets application state from the given ApplicationStateData instance. Several optional parameters are available to animate / tween to the new state. When
animateTo
is true an animation is scheduled via AnimationAPI.to and the duration and easing name or function may be specified.Note: If serializing application state any minimized apps will use the before minimized state on initial render of the app as it is currently not possible to render apps with Foundry VTT core API in the minimized state.
Parameters
- data: ApplicationStateData
Saved data set name.
Optional
options: {
animateTo?: boolean;
async?: boolean;
duration?: number;
ease?: EasingReference;
}Optional parameters
Optional
animateTo ?: booleanAnimate to restore data.
Optional
async?: booleanOptional
duration?: numberDuration in seconds.
Optional
ease?: EasingReferenceEasing function.
Returns void
- data: ApplicationStateData
Provides the ability the save / restore / serialize application state for positional and UI state such as minimized status.
You can restore a saved state with animation; please see the options of ApplicationState.restore.