Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initOpenSeaDragon = () => {
const { id, container, pages, renderError, updateContextState } = this.props
// Detect browser vendor
this.browser = getKeyByValue(OpenSeaDragon.BROWSERS, OpenSeaDragon.Browser.vendor)
// Create viewer
this.viewer = OpenSeaDragon({
element: this.OSDContainer.current,
tileSources: pages[0],
...OSDConfig,
})
// Events handler
this.viewer.addHandler('open', () => {
this.renderLayout()
this.fitBounds()
// Prevent unessesart context updates
if (renderError) {
updateContextState({ renderError: false })