Skip to main content

Callbacks

The optional JavaScript callback functions enables developers to react on events fired by FSI Layers.

Refer to the appropriate chapter to learn how to implement callbacks.

The following callback functions can be used:

onConfigsReady

onConfigsReady(config)
Called as soon as the configuration is loaded.

config
object
Configuration parameters as object
instance.addListener('onConfigsReady', (config) => {
// config loaded
myFunc(config)
})
Example

onInit

onInit(parameters)
Called as soon as the viewer is initialized.

parameters
object
parameters as object
instance.addListener('onInit', (parameters) => {
// instance initialized
myFunc(parameters)
})
Example

onLoadChange

onLoadChange(loading)
Called as soon as the loading is changed.

loading
boolean
`true` = loading in progress
instance.addListener('onLoadChange', (loading) => {
// load change
myFunc(loading)
})
Example

onLoadProgress

onLoadProgress(loading)
Called as soon as the loading progress changed.

loading
integer
Amount of objects (e.g. images) that need to be loaded
instance.addListener('onLoadProgress', (loading) => {
// loading progress changed
myFunc(loading)
})
Example

onReady

onReady()
Called as soon as the instance is ready. Afterwards you can add/remove layers and change properties using the API.

instance.addListener('onReady', () => {
// instance is ready
doReallyGoodThings()
})
Example

onRenderLayer

onRenderLayer(layer)
Called as soon as the layer rendering is started.

layer
integer
layer name
instance.addListener('onRenderLayer', (layer1) => {
// layer1 is rendered
myFunc(layer1)
})
Example

onRenderLayerDone

    onRenderLayerDone(layer)
Called as soon as the layer rendering is finished.

layer
integer
layer name
instance.addListener('onRenderLayerDone', (layer1) => {
// layer1 rendering is done
myFunc(layer1)
})
Example

onRenderStart

onRenderStart()
Called as soon as the rendering of all layers starts.

instance.addListener('onRenderStart', () => {
// rendering of all layers is started
doReallyGoodThings()
})
Example

onRenderFinished

onRenderFinished()
Called as soon as the rendering of all layers is finished.

instance.addListener('onRenderFinished', () => {
// rendering of all layers is finished
doReallyGoodThings()
})
Example

onReset

onReset()
Called as soon as the instance is reset.

instance.addListener('onReset', () => {
// instance is reset
doReallyGoodThings()
})
Example

onResize

onResize(width, height, resize, fullscreen)
Called as soon as the instance is resized to a certain dimension.

width
integer
width of instance
height
integer
height of instance
resize
boolean
`true` = resize process is finished
fullscreen
boolean
If fullscreen is relevant
instance.addListener('onResize', (400,500,true,true) => {
// instance is resized
myFunc(400,500,true,true)
})
Example