Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Math.random().toString(36).substring(2, 5) +
Math.random().toString(36).substring(2, 5)
);
this.model.set('dom_element_id', randomStr);
this.hgContainer = document.createElement('div');
this.hgContainer.setAttribute('id', randomStr);
this.hgDisplay = document.createElement('div');
this.hgDisplay.style.border = this.options.theme === 'dark'
? '#333333' : '#dddddd';
this.hgDisplay.style.borderRadius = '2px';
this.hgContainer.appendChild(this.hgDisplay);
this.el.appendChild(this.hgContainer);
this.hg = hglib.viewer(this.hgDisplay, this.viewConfig, this.getOptions());
this.hgContainer.api = this.hg;
// Listen to events from the JavaScript world
this.hg.on('cursorLocation', this.setCursorLocation.bind(this));
this.hg.on('rangeSelection', this.setSelection.bind(this));
this.hg.on('viewConfig', this.setViewConfig.bind(this));
this.locationListeners = [];
this.setupLocationListeners();
// Listen to messages from the Python world
this.model.on("change:height", this.handleChange, this);
this.model.on("change:select_mode", this.handleChange, this);
this.model.on("change:viewconf", this.handleChange, this);
this.model.on("change:auth_token", this.handleChange, this);
self.hg = hglib.viewer(self.hgDisplay, self.viewConfig, self.getOptions());
break;
case 'bounded':
self.bounded = value;
self.hg = hglib.viewer(self.hgDisplay, self.viewConfig, self.getOptions());
break;
case 'default_track_options':
self.defaultTrackOptions = value;
self.hg = hglib.viewer(self.hgDisplay, self.viewConfig, self.getOptions());
break;
case 'dark_mode':
self.darkMode = value;
self.hg = hglib.viewer(self.hgDisplay, self.viewConfig, self.getOptions());
break;
case 'renderer':
self.renderer = value;
self.hg = hglib.viewer(self.hgDisplay, self.viewConfig, self.getOptions());
break;
case 'selection_on_alt':
self.selectionOnAlt = value;
self.hg = hglib.viewer(self.hgDisplay, self.viewConfig, self.getOptions());
break;
case 'options':
self.options = value;
self.hg = hglib.viewer(self.hgDisplay, self.viewConfig, self.getOptions());
break;