Class: LayoutInstance

Constructors

constructor

new LayoutInstance(name, data, resourceBase, renderer, container, options): LayoutInstance

Parameters

Name Type
name string
data Layout
resourceBase string
renderer LayoutRenderer
container null | Container<DisplayObject>
options LayoutCreateOptions

Returns

LayoutInstance

Properties

animations

animations: AnimationCallback[]


dirtyPromise

Private dirtyPromise: null | ResolvablePromise<void>


dirtyUpdate

Private dirtyUpdate: ResizeCallback


eventCancels

eventCancels: Record<string, () => void[]>


htmlElements

Private htmlElements: null | [Element, HTMLDisplayObject<HTMLElement>][]


isDirtyHierarchy

Private isDirtyHierarchy: boolean


isDirtyStateCache

Private isDirtyStateCache: boolean


language

language: null | Language


name

name: string


pixiContainer

pixiContainer: Container<DisplayObject>


pixiParentContainer

pixiParentContainer: null | Container<DisplayObject>


renderer

renderer: LayoutRenderer


resourceBase

resourceBase: string


roots

roots: Element[]


safeArea

Private safeArea: null | SafeArea


settings

settings: Settings


stateCache

Private Optional stateCache: Record<string, Element[]>

Methods

adjust

adjust(realScreenSize): void

Parameters

Name Type
realScreenSize Size

Returns

void


animateUpdate

animateUpdate(time): void

Parameters

Name Type
time number

Returns

void


cancelEvent

cancelEvent(eventName): boolean

Parameters

Name Type
eventName string

Returns

boolean


destroy

destroy(): void

Returns

void


dirty

dirty(): Promise<void>

Returns

Promise<void>


dirtyHierarchy

dirtyHierarchy(): void

Flag node hierarchy as modified. Note that it’s only necessary to call this if new nodes need to be added or existing nodes need to be hidden. Destroying display objects will gracefully remove them from the layout’s PIXI.Container.

Returns

void


dirtyStateCache

dirtyStateCache(): void

Flag the layout state cache as modified. This is needed when new element modifiers are added or existing ones are removed, or when new elements are added to the layout hierarchy dynamically.

Returns

void


elements

elements(): Generator<Element, any, unknown>

Iterate over all elements in the layout hierarchy.

Returns

Generator<Element, any, unknown>

elements(matcher): Generator<Element, any, unknown>

Iterate over all elements in the layout hierarchy. Can optionally filter the nodes based on type and/or name.

Parameters

Name Type Description
matcher Matcher<Element> Filtering options

Returns

Generator<Element, any, unknown>

elements(filter): Generator<Element, any, unknown>

Iterate over all elements in the layout hierarchy. The iterator skips nodes whose name does not match the provided filter.

Parameters

Name Type Description
filter Filter String or RegExp for filtering the nodes

Returns

Generator<Element, any, unknown>

elements<T>(type): Generator<T, any, unknown>

Iterate over all elements in the layout hierarchy. The iterator skips nodes whose type does not match the provided type.

Type parameters

Name Type
T extends Element

Parameters

Name Type Description
type Type<T> Type for filtering the nodes

Returns

Generator<T, any, unknown>

elements<T>(type, filter): Generator<T, any, unknown>

Iterate over all elements in the layout hierarchy. The iterator skips nodes whose type does not match the provided type or name does not match the provided filter.

Type parameters

Name Type
T extends Element

Parameters

Name Type Description
type Type<T> Type for filtering the nodes
filter Filter String or RegExp for filtering the nodes

Returns

Generator<T, any, unknown>


event

event(states, params?): Promise<void>

Parameters

Name Type
states string | Event[]
params? EventParams

Returns

Promise<void>


getElement

getElement(matcher): undefined | Element

Returns the first node from the layout hierarchy that matches the filtering options.

Parameters

Name Type Description
matcher Matcher<Element> Filtering options

Returns

undefined | Element

getElement(filter): undefined | Element

Returns the first node from the layout hierarchy whose name matches the provided filter.

Parameters

Name Type Description
filter Filter String or RegExp for filtering the nodes

Returns

undefined | Element

getElement<T>(type): undefined | T

Returns the first node from the layout hierarchy whose type matches the provided type.

Type parameters

Name Type
T extends Element

Parameters

Name Type Description
type Type<T> Type for filtering the nodes

Returns

undefined | T

getElement<T>(type, filter): undefined | T

Returns the first element from the layout hierarchy whose type matches the provided type and name matches the provided filter.

Type parameters

Name Type
T extends Element

Parameters

Name Type Description
type Type<T> Type for filtering the nodes
filter Filter String or RegExp for filtering the nodes

Returns

undefined | T


getEvent

getEvent(name): undefined | Event[]

Parameters

Name Type
name string

Returns

undefined | Event[]


requestAnimationFrame

requestAnimationFrame(animation): void

Parameters

Name Type
animation AnimationCallback

Returns

void


requireElement

requireElement(matcher): Element

Returns the first node from the layout hierarchy that matches the filtering options. Throws an error if the node is not found.

Parameters

Name Type Description
matcher Matcher<Element> Filtering options

Returns

Element

requireElement(filter): Element

Returns the first node from the layout hierarchy whose name matches the provided filter. Throws an error if the node is not found.

Parameters

Name Type Description
filter Filter String or RegExp for filtering the nodes

Returns

Element

requireElement<T>(type): T

Returns the first node from the layout hierarchy whose type matches the provided type. Throws an error if the node is not found.

Type parameters

Name Type
T extends Element

Parameters

Name Type Description
type Type<T> Type for filtering the nodes

Returns

T

requireElement<T>(type, filter): T

Returns the first node from the layout hierarchy whose type matches the provided type and name matches the provided filter. Throws an error if the node is not found.

Type parameters

Name Type
T extends Element

Parameters

Name Type Description
type Type<T> Type for filtering the nodes
filter Filter String or RegExp for filtering the nodes

Returns

T


setSafeArea

setSafeArea(«destructured»): void

Set the safe area insets to offset the element aligns from the edges during adjust.

Parameters

Name Type
«destructured» SafeArea

Returns

void


setState

setState(state, options?): Promise<boolean>

Parameters

Name Type
state string
options? Object
options.instant? boolean
options.validate? boolean

Returns

Promise<boolean>


translate

translate(str, params?): string

Parameters

Name Type
str string
params? Object

Returns

string


updateStateCache

updateStateCache(): void

Returns

void