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

Member Summary

Public Members
public get
public get
public get
public get

el: *

public get

flatEl: *

public get
public get
public get
public get

router: *

Method Summary

Public Methods
public

appendComponent(childComponent: Component)

appendComponent adds the childComponent's flatEl, portalEl, portalGraph, and immersiveGraph to this Component's equivalent attributes.

public

removeComponent(childComponent: *)

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() source

Public Members

public get actionManager: * source

public get assetLoader: * source

public get displayMode: * source

public get el: * source

public get flatEl: * source

public get immersiveScene: * source

public get portalEl: * source

public get portalScene: * source

public get router: * source

Public Methods

public appendComponent(childComponent: Component) source

appendComponent adds the childComponent's flatEl, portalEl, portalGraph, and immersiveGraph 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 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