Home Reference Source
import App from 'potassium-es'
public class | source

App

Extends:

EventHandler → App

App contains the orchestration logic for the entirety of what is being displayed for a given app, including the app chrome like navigation.

It contains the root data structures for each display mode:

  • For flat mode it holds a DOM element.
  • For portal mode it holds a DOM element for overlay controls and a 3D scene for spatial controls and virtual environments.
  • For immersive mode it holds a 3D scene for spatial controls as well as virtual environments.

It manages WebXR sessions for portal and immersive modes. It also toggles the visibility of the flat and portal DOM fragments as display modes change.

App communicates these changes to Components via events so that they may react.

Constructor Summary

Public Constructor
public

constructor(options: Object)

Member Summary

Public Members
public get

actionManager: ActionManager

public get
public get
public get

dom: HTMLElement

public get

flatDOM: HTMLElement

public get

immersiveSOM: THREE.Group

public get

immersiveScene: THREE.Group

public get
public set
public get
public get

portalDOM: HTMLElement

public get

portalSOM: THREE.Group

public get

portalScene: THREE.Group

public get

Method Summary

Public Methods
public

appendComponent(childComponent: Component)

appendComponent adds the childComponent's flatDOM, portalDOM, portalSOM, and immersiveSOM to this Component's equivalent attributes.

public

removeComponent(childComponent: *)

public
public
public

toggleFlatDisplay(show: bool, immersive: bool)

toggleFlatDisplay enables creators to see a debugging view into the immersive scene on their flat screens.

Inherited Summary

From class EventHandler
public get

listeners: EventListener[]: *

public

addListener(callback: function(eventName: string, eventSource: EventHandler), eventName: Object | Symbol, once: bool)

public
public

removeListener(callback: *, eventName: undefined)

public

trigger(eventName: *, params: ...*)

Send an event to listeners

Public Constructors

public constructor(options: Object) source

Params:

NameTypeAttributeDescription
options Object
  • optional
options.textInputComponent Component
  • optional
  • default: null

Public Members

public get actionManager: ActionManager source

public get assetLoader: AssetLoader source

public get displayMode: string source

public get dom: HTMLElement source

public get flatDOM: HTMLElement source

public get immersiveSOM: THREE.Group source

public get immersiveScene: THREE.Group source

public get localizerGatheredData: * source

public set localizerGathering source

public get localizerGathering: * source

public get portalDOM: HTMLElement source

public get portalSOM: THREE.Group source

public get portalScene: THREE.Group source

public get router: Router source

Public Methods

public appendComponent(childComponent: Component) source

appendComponent adds the childComponent's flatDOM, portalDOM, portalSOM, and immersiveSOM to this Component's equivalent attributes.

Params:

NameTypeAttributeDescription
childComponent Component

public removeComponent(childComponent: *) source

Params:

NameTypeAttributeDescription
childComponent *

public setDisplayMode(value: string): Promise<string> source

Params:

NameTypeAttributeDescription
value string

flat|portal|immersive

Return:

Promise<string>

display mode

public toggleEdges() source

public toggleFlatDisplay(show: bool, immersive: bool) source

toggleFlatDisplay enables creators to see a debugging view into the immersive scene on their flat screens. This is handy for coding and styling spatial controls when a headset is not available or you are having a good hair day and don't want to mess with success.

Params:

NameTypeAttributeDescription
show bool
  • optional
  • default: null

if true, create and show the display, otherwise tear it down

immersive bool
  • optional
  • default: true

if true then show the immersive scene, otherwise show the portal scene