Applications are constructed by providing an object of configuration options.
Optionaloptions: Partial<ApplicationConfiguration & DialogV2Configuration> = {}Options used to configure the Application instance
Application instance configuration options.
The current position of the application with respect to the window.document.body.
If this Application uses tabbed navigation groups, this mapping is updated whenever the changeTab method is called.
Reports the active tab for each group, with a value of null indicating no tab is active.
Subclasses may override this property to define default tabs for each group.
Static Internal_An incrementing integer Application ID.
Static Internal_The current maximum z-index of any displayed Application.
StaticBASE_Designates which upstream Application class in this class' inheritance chain is the base application. Any DEFAULT_OPTIONS of super-classes further upstream of the BASE_APPLICATION are ignored. Hook events for super-classes further upstream of the BASE_APPLICATION are not dispatched.
StaticDEFAULT_StaticemittedStaticPARTSStaticRENDER_The sequence of rendering states that describe the Application life-cycle.
StaticTABSConfiguration of application tabs, with an entry per tab group.
The child Applications registered under this one via renderChild.
The CSS class list of this Application instance
The Document that is being shown.
The HTMLElement which renders this Application into the DOM.
Does this Application have a top-level form element?
Does this Application instance render within an outer window frame?
The HTML element ID of this Application instance.
This provides a readonly view into the internal ID used by this application.
This getter should not be overridden by subclasses, which should instead configure the ID in DEFAULT_OPTIONS or
by defining a uniqueId during _initializeApplicationOptions.
Whether the Document that is being shown is an image-type JournalEntryPage.
Is this Application instance currently minimized?
The parent Application of this Application, if registered via renderChild.
Is this Application instance currently rendered?
The current render state of the Application.
Convenience references to window header elements.
InternalWait for a CSS transition to complete for an element.
The element which is transitioning
A timeout in milliseconds in case the transitionend event does not occur
Whether this Application is permitted to detach from the main workspace. Managed children (those with an active parent) may detach to break the parent link and claim their own window.
InternalPerform an event in the application life-cycle. Await an internal life-cycle method defined by the class. Optionally dispatch an event for any registered listeners.
A handler function to call
Options which configure event handling
Optionalasync?: booleanAwait the result of the handler function?
OptionaldebugText?: stringDebugging text to log for the event
OptionaleventName?: stringAn event name to dispatch for registered listeners
OptionalhandlerArgs?: any[]Arguments passed to the handler function
OptionalhookArgs?: any[]Arguments passed to the requested hook function
OptionalhookName?: stringA hook name to dispatch for this and all parent classes
OptionalhookResponse?: booleanAdd the handler response to hookArgs
OptionalparentClassHooks?: booleanCall hooks for parent classes in the inheritance chain?
A promise which resoles once the handler is complete if async is true
Add a new event listener for a certain type of event.
The type of event being registered for
The listener function called when the event occurs
Optionaloptions: { once?: boolean } = {}Options which configure the event listener
Optionalonce?: booleanShould the event only be responded to once and then removed
Re-attach a detached application to the main workspace. If this application was previously a child and was manually detached, breaking its parent link, this method first attempts to re-join the prior parent's window before falling back to the main workspace.
Optionaloptions: ApplicationRenderOptions = {}Render options.
Bring this Application window to the front of the rendering stack by increasing its z-index. Once ApplicationV1 is deprecated we should switch from _maxZ to ApplicationV2#maxZ We should also eliminate ui.activeWindow in favor of only ApplicationV2#frontApp
Change the active tab within a tab group in this Application instance.
The name of the tab which should become active
The name of the tab group which defines the set of tabs
Optionaloptions: {Additional options which affect tab navigation
Optionalevent?: EventAn interaction event which caused the tab change, if any
Optionalforce?: booleanForce changing the tab even if the new tab is already active
OptionalnavElement?: HTMLElementAn explicit navigation element being modified
OptionalupdatePosition?: booleanUpdate application position after changing the tab?
Close the Application, removing it from the DOM.
Optionaloptions: Partial<ApplicationClosingOptions> = {}Options which modify how the application is closed.
A Promise which resolves to the closed Application instance
Detach an application from the main workspace, and render it in a separate browser window. If this application is a registered child, detaching it breaks the parent link and gives it its own window.
Optionaloptions: ApplicationRenderOptions = {}Render options.
Dispatch an event on this target.
The Event to dispatch
Was default behavior for the event prevented?
Restore the Application to its original dimensions.
Minimize the Application, collapsing it to a minimal header.
Remove an event listener for a certain type of event.
The type of event being removed
The listener function being removed
Render the Application, creating its HTMLElement and replacing its innerHTML. Add it to the DOM if it is not currently rendered and rendering is forced. Otherwise, re-render its contents.
Optionaloptions: boolean | ApplicationRenderOptions = {}Options which configure application rendering behavior. A boolean is interpreted as the "force" option.
Optional_options: ApplicationRenderOptions = {}Legacy options for backwards-compatibility with the original ApplicationV1#render signature.
A Promise which resolves to the rendered Application instance
Render another Application as a child of this one. The child is rendered in the same window as this application and moves with it when it is detached or re-attached. Closing this application will also close the child. If the child was previously registered under a different parent, that link is replaced.
The child application to render.
Optionaloptions: ApplicationRenderOptions = {}Render options passed to the child's render method.
A Promise which resolves to the rendered child Application.
Update the Application element position using provided data which is merged with the prior position.
Optionalposition: Partial<ApplicationPosition>New Application positioning data
The updated application position
Programmatically submit an ApplicationV2 instance which implements a single top-level form.
OptionalsubmitOptions: object = {}Arbitrary options which are supported by and provided to the configured form submission handler.
A promise that resolves to the returned result of the form submission handler, if any.
Protected_ProtectedWhether this Application is permitted to re-attach to the main workspace. Managed children (those with an active parent) cannot re-attach independently; their parent controls placement.
Protected_ProtectedTest whether this Application is allowed to be rendered.
Provided render options
Return false to prevent rendering
Protected_ProtectedModify the provided options passed to a render request.
Options which configure application rendering behavior
Protected_ProtectedCreate a ContextMenu instance used in this Application.
A handler function that provides initial context options
A CSS selector to which the ContextMenu will be bound
Optionaloptions: { container?: HTMLElement; hookName?: string; parentClassHooks?: boolean } = {}Additional options which affect ContextMenu construction
Optionalcontainer?: HTMLElementA parent HTMLElement which contains the selector target
OptionalhookName?: stringThe hook name
OptionalparentClassHooks?: booleanWhether to call hooks for the parent classes in the inheritance chain.
A created ContextMenu or null if no menu items were defined
Protected_ProtectedConfigure the array of header control menu options
Protected_ProtectedGet the configuration for a tabs group.
The ID of a tabs group
Protected_ProtectedIterate over header control buttons, filtering for controls which are visible for the current client.
Protected_ProtectedGenerate context menu entries based on the header control specification.
Protected_ProtectedInsert the application HTML element into the DOM. Subclasses may override this method to customize how the application is inserted.
The element to insert
Optionaloptions: ApplicationRenderOptions = {}Render options.
Protected_ProtectedActions performed after the Application has been re-attached to the main workspace. Registered child Applications are re-attached automatically after this method returns.
The Application's former host document. This document's window may have been closed.
The main workspace document.
Protected_ProtectedA generic event handler for action clicks which can be extended by subclasses. Action handlers defined in DEFAULT_OPTIONS are called first. This method is only called for actions which have no defined handler.
The originating click event
The capturing HTML element which defined a [data-action]
Protected_ProtectedHandle click events on a tab within the Application.
Protected_ProtectedActions performed after closing the Application. Post-close steps are not awaited by the close process.
Provided render options
Protected_ProtectedActions performed after the Application has been detached from the main workspace. Registered child Applications are moved into the same detached window automatically after this method returns.
The main workspace document.
The Application's new host document.
Protected_ProtectedHandle keypresses within the dialog.
The triggering event.
Protected_ProtectedActions performed after the Application is re-positioned.
The requested application position
Protected_ProtectedActions performed after any render of the Application.
Prepared context data
Provided render options
Protected_ProtectedHandle submitting the dialog.
The button that was clicked or the default button.
The triggering event.
Protected_ProtectedHandle submission for an Application which uses the form element.
The form configuration for which this handler is bound
The form submission event
Protected_ProtectedPerform post-render finalization actions.
Prepared context data.
Provided render options.
Protected_ProtectedActions performed before closing the Application. Pre-close steps are awaited by the close process.
Provided render options
Protected_ProtectedActions performed before a first render of the Application.
Prepared context data
Provided render options
Protected_ProtectedPrepare application tab data for a single tab group.
The ID of the tab group to prepare
Protected_ProtectedActions performed before the Application is re-positioned. Pre-position steps are not awaited because setPosition is synchronous.
The requested application position
Protected_ProtectedActions performed before any render of the Application. Pre-render steps are awaited by the render process.
Prepared context data
Provided render options
Protected_ProtectedRemove the application HTML element from the DOM. Subclasses may override this method to customize how the application element is removed.
The element to be removed
Protected_ProtectedRender configured buttons.
Protected_ProtectedRender the outer framing HTMLElement which wraps the inner HTML of the Application.
Options which configure application rendering behavior
Protected_ProtectedRender a header control button.
Protected_ProtectedRemove elements from the DOM and trigger garbage collection as part of application closure.
Protected_ProtectedWhen the Application is rendered, optionally update aspects of the window frame.
Options provided at render-time
Protected_ProtectedTranslate a requested application position updated into a resolved allowed position for the Application. Subclasses may override this method to implement more advanced positioning behavior.
Requested Application positioning data
Resolved Application positioning data
Static_StaticconfirmA utility helper to generate a dialog with yes and no buttons.
Optionalconfig: Partial<ApplicationConfiguration & DialogV2Configuration & DialogV2WaitOptions> = {}Options to overwrite the default yes button configuration.
Options to overwrite the default no button configuration.
Resolves to true if the yes button was pressed, or false if the no button was pressed. If additional buttons were provided, the Promise resolves to the identifier of the one that was pressed, or the value returned by its callback. If the dialog was dismissed, and rejectClose is false, the Promise resolves to null.
StaticinheritanceIterate over the inheritance chain of this Application. The chain includes this Application itself and all parents until the base application is encountered.
StaticinputA utility helper to generate a dialog for user input.
Optionalconfig: Partial<ApplicationConfiguration & DialogV2Configuration & DialogV2WaitOptions> = {}Options to overwrite the default confirmation button configuration.
Resolves to the data of the form if the ok button was pressed, or the value returned by that button's callback. If additional buttons were provided, the Promise resolves to the identifier of the one that was pressed, or the value returned by its callback. If the dialog was dismissed, and rejectClose is false, the Promise resolves to null.
StaticinstancesIterate over the instances of this Application.
StaticparseParse a CSS style rule into a number of pixels which apply to that dimension.
The CSS style rule
The relevant dimension of the parent element
The parsed style dimension in pixels
StaticpromptA utility helper to generate a dialog with a single confirmation button.
Optionalconfig: Partial<ApplicationConfiguration & DialogV2Configuration & DialogV2WaitOptions> = {}Options to overwrite the default confirmation button configuration.
Resolves to the identifier of the button used to submit the dialog, or the value returned by that button's callback. If additional buttons were provided, the Promise resolves to the identifier of the one that was pressed, or the value returned by its callback. If the dialog was dismissed, and rejectClose is false, the Promise resolves to null.
StaticqueryPresent an asynchronous Dialog query to a specific User for response.
A User instance or a User id
The type of Dialog to present
Optionalconfig: object = {}Dialog configuration forwarded on to the Dialog.prompt, Dialog.confirm, Dialog.input, or Dialog.wait function depending on the query type. Callback options are not supported.
The query response or null if no response was provided
StaticwaitSpawn a dialog and wait for it to be dismissed or submitted.
Optionalconfig: Partial<ApplicationConfiguration & DialogV2Configuration & DialogV2WaitOptions> = {}Resolves to the identifier of the button used to submit the dialog, or the value returned by that button's callback. If the dialog was dismissed, and rejectClose is false, the Promise resolves to null.
StaticwaitWait for any images in the given element to load.
The element.
Protected Static_ProtectedRedirect all clicks of buttons with action specifications to the submit handler.
The originating click event.
The button element that was clicked.
A dialog for configuring options when showing content to players.
Mixes
HandlebarsApplication