View
Provides methods to deal with active view components and their state.
Hierarchy
View
Summary
Methods | |
---|---|
getCurrentScreenRootElement | Returns the current screen DOM element. Used for class tweaks through DOM manipulation for animations. |
render |
Returns a Promise that will be resolved when the screen/block has been rendered with current model changes.
Used to execute logic after the browser has rendered the current changes.
|
wasCurrentViewRestoredFromCache | Checks if the current view state was restored from cache. |
Methods
getCurrentScreenRootElement
getCurrentScreenRootElement(): Element
Returns the current screen DOM element. Used for class tweaks through DOM manipulation for animations.
Between transitions there are two screens (the one leaving and the one entering), and this function will return the entering screen.
Example:
// add custom class 'slide' to screen DOM element $public.View.getCurrentScreenRootElement().classList.add("slide");
Returns: Element
render
render(): Promise<void>
Returns a Promise
that will be resolved when the screen/block has been rendered with current model changes. Used to execute logic after the browser has rendered the current changes.
Returns: Promise<void>
Promise
resolved when the screen/block has been rendered with current model changes.
wasCurrentViewRestoredFromCache
wasCurrentViewRestoredFromCache(): boolean
Checks if the current view state was restored from cache.
Returns: boolean
Returns true
when the current view state was restored from cache, or false
otherwise.