Skip to main content

Callbacks

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

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

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

onDestroy​

onDestroy()
Called as soon as the viewer is destroyed.

instance.addListener('onDestroy', () => {
// instance is destroyed
doReallyGoodThings()
})
Example

onInit​

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

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

onReady​

onReady()
Called as soon as the instance is ready.

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

onZoomChanged​

onZoomChanged(docScale, pixelRatio)
Called as soon as the zoom scope is changed.

docScale
float
the document scale
pixelRatio
object
document scale pixel ratio
instance.addListener('onZoomChanged', (docScale, pixelRatio) => {
// zoom scope changed
myFunc(docScale, pixelRatio)
})
Example