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.
instance.addListener('onConfigsReady', (config) => {
// config loaded
myFunc(config)
})
Example
onInit
onInit(parameters)
Called as soon as the viewer is initialized.
instance.addListener('onInit', (parameters) => {
// instance initialized
myFunc(parameters)
})
Example
onLoadChange
onLoadChange(loading)
Called as soon as the loading is changed.
instance.addListener('onLoadChange', (loading) => {
// load change
myFunc(loading)
})
Example
onLoadProgress
onLoadProgress(loading)
Called as soon as the loading progress changed.
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.
instance.addListener('onRenderLayer', (layer1) => {
// layer1 is rendered
myFunc(layer1)
})
Example
onRenderLayerDone
onRenderLayerDone(layer)
Called as soon as the layer rendering is finished.
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.
instance.addListener('onResize', (400,500,true,true) => {
// instance is resized
myFunc(400,500,true,true)
})
Example