Callbacks
The optional JavaScript callback functions enables developers to react on events fired by FSI ThumbBar.
Refer to the appropriate chapter to learn how to implement callbacks.
The following callback functions can be used:
onAfterReplaceLabelTemplates
onAfterReplaceLabelTemplates(label, item)
Called directly after the Label Template is replaced.
instance.addListener('onAfterReplaceLabelTemplates', (label, item) => {
// AFTER label template replacement
myFunc(label, item)
})
Example
onBeforeReplaceLabelTemplates
onBeforeReplaceLabelTemplates(label, item)
Called directly before the Label Template is replaced.
instance.addListener('onBeforeReplaceLabelTemplates', (label, item) => {
// BEFORE label template replacement
myFunc(label, item)
})
Example
onChangeConfig
onChangeConfig(cfgFile, parameters)
Called as soon as the config is changed.
instance.addListener('onChangeConfig', (cfgFile, parameters) => {
// config changed
myFunc(cfgFile, parameters)
})
Example
onClick
onClick(index, item)
Called each time the user clicks an image.
instance.addListener('onClick', (index, item) => {
// click
myFunc(index, item)
})
Example
onConfigsReady
onConfigsReady(config)
Called as soon as the configuration is loaded.
instance.addListener('onConfigReady', (config) => {
// config loaded
myFunc(config)
})
Example
onDestroy
onDestroy()
Called as soon as the viewer is destroyed.
instance.addListener('onDestroy', () => {
// instance is destroyed
doReallyGoodThings()
})
Example
onFocus
onFocus(imgIndex, imgPath)
Called each time the foreground image changes.
instance.addListener('onFocus', (imgIndex, imgPath) => {
// image focused
myFunc(index, item)
})
Example
onSelectedImageChange
onSelectedImageChange(index, item)
Called each time the image selected changes.
instance.addListener('onSelectedImageChange', (index, item) => {
// selected image is changed
myFunc(index, item)
})
Example
onInit
onInit(parameters)
Called as soon as the viewer is initialized.
instance.addListener('onInit', (parameters) => {
// instance initialized
myFunc(parameters)
})
Example
onMetaData
onMetaData(item, metadata)
Called as soon as the metadata is loaded.
instance.addListener('onMetaData', (item, metadata) => {
// meta data loaded
myFunc(item, metadata)
})
Example
onMouseEnter
onMouseEnter(index, item)
Called as soon the mouse enters the defined area.
instance.addListener('onMouseEnter', (index, item) => {
// mouse enters selection
myFunc(index, item)
})
Example
onMouseLeave
onMouseLeave(index, item)
Called as soon the mouse leaves the defined area.
instance.addListener('onMouseLeave', (index, item) => {
// mouse leaves selection
myFunc(index, item)
})
Example
onReady
onReady()
Called as soon as the instance is ready.
instance.addListener('onReady', () => {
// instance is ready
doReallyGoodThings()
})
Example
onReplaceTemplateValue
onReplaceTemplateValue(name, value)
Called while the template value is replaced.
instance.addListener('onReplaceTemplateValue', (name, value) => {
// template value is currently replaced
myFunc(name, value)
})
Example
onResize
onResize(width, height, done)
Called as soon as the instance is resized.
instance.addListener('onResize', (width, height, done) => {
// resize
myFunc(width, height, done)
})
Example
onScrollStart
onScrollStart(position)
Called as soon as the scrolling is started.
instance.addListener('onScrollStart', (position) => {
// scroll starts
myFunc(position)
})
Example
onScrollEnd
onScrollEnd(position)
Called as soon as the scrolling is finished.
instance.addListener('onScrollEnd', (position) => {
// scroll ends
myFunc(position)
})
Example
onSetScrollRange
onSetScrollRange(totalSize,range,endless,totalImg)
Called as soon as the defined scroll range is set.
instance.addListener('onSetScrollRange', (totalSize,range,endless,totalImg) => {
// scroll range is set
myFunc(totalSize,range,endless,totalImg)
})
Example
onStart
onStart(directory,images,imgPaths)
Called as soon as the instance is started.
instance.addListener('onStart', (directory,images,imgPaths) => {
// instance is started
myFunc(directory,images,imgPaths)
})
Example
onZoomEnd
onZoomEnd()
Called each time a zoomed image has been closed.
instance.addListener('onZoomEnd', () => {
// zoom ends
doReallyGoodThings()
})
Example
onZoomReady
onZoomReady(index, zoomImgURL, zoomImg)
Called as soon as the zoom is ready.
instance.addListener('onZoomReady', (index, zoomImgURL, zoomImg) => {
// zoom is ready
myFunc(index, zoomImgURL, zoomImg)
})
Example
onZoomStart
onZoomStart(index, imgURL)
Called as soon as the zoom is started.
instance.addListener('onZoomReady', (index, imgURL) => {
// zoom is ready
myFunc(index, imgURL)
})
Example