Doc > API > TypedViewer

Doc > API > TypedViewer

Base class to create a viewer. It is used for the Threejs viewer as well as the Mapbox Viewer

Methods

.mount(element: HTMLElement)

mounts the viewer onto an element

.unmount()

unmounts the viewer

.canvas()

return the canvas and create one if none yet

.camera()

return the camera the viewer was created with

.dispose()

disposes the viewer

.setAutoRender(state = true)

sets auto render state. If falls, the viewer will not render.

.updateAutoRenderOnIntersectionChange(_options: TypedViewerInterectionObserverChangeOptions)

This sets the viewer to detect if it is visible, and to pause/unpause itself when its visibility changes.

This can be very useful to improve performance.

.registerOnBeforeTick(callbackName: string, callback: ViewerTickCallback, options: BaseViewerCallbackOptions =

registers a BeforeTick callback. BeforeTick callbacks are run before updating the frame (and therefore before any time dependent node has changed)

.unRegisterOnBeforeTick(callbackName: string)

unregisters BeforeTick callback

.registeredBeforeTickCallbacks()

Returns the list registered BeforeTick callback names

.registerOnAfterTick(callbackName: string, callback: ViewerTickCallback, options: BaseViewerCallbackOptions =

registers AfterTick callback. AfterTick callbacks are run after updating the frame (and therefore after any time dependent node has changed)

.unRegisterOnAfterTick(callbackName: string)

unregisters AfterTick callback

.registeredAfterTickCallbacks()

Returns the list registered AfterTick callback names

.registerOnBeforeRender( callbackName: string, callback: ViewerRenderCallback, options: BaseViewerCallbackOptions =

registers a BeforeRender callback. BeforeRender callbacks are run before the frame is rendered

.unRegisterOnBeforeRender(callbackName: string)

unregisters BeforeRender callback

.registeredBeforeRenderCallbacks()

Returns the list registered BeforeRender callback names

.registerOnAfterRender( callbackName: string, callback: ViewerRenderCallback, options: BaseViewerCallbackOptions =

registers a AfterRender callback. AfterRender callbacks are run after the frame is rendered

.unRegisterOnAfterRender(callbackName: string)

unregisters AfterRender callback

.registeredAfterRenderCallbacks()

Returns the list AfterRender BeforeRender callback names

source
Is this doc helpful/not helpful? Is there any information you would like that is not available? Don't hesitate to get in touch with any question or feedback, either by email, on Discord or the forum.