let besServices = [] // Collection of all grammar checking services in the document /// /// Grammar checking service base class /// class BesService { constructor(hostElement) { this.hostElement = hostElement this.timer = null this.children = [] const { correctionPanel, scrollPanel, statusDiv, statusIcon } = this.createCorrectionPanel(hostElement) this.correctionPanel = correctionPanel this.scrollPanel = scrollPanel this.statusDiv = statusDiv this.statusIcon = statusIcon this.offsetTop = null this.textAreaService = null this.originalSpellcheck = hostElement.spellcheck this.abortController = new AbortController() hostElement.spellcheck = false hostElement.addEventListener('click', BesService.handleClick) hostElement.addEventListener('scroll', BesService.handleScroll) if (this.constructor === BesService) { hostElement.addEventListener( 'beforeinput', BesService.handleBeforeInput, false ) this.lineChangeObserver(hostElement) } besServices.push(this) } /** * Registers grammar checking service * * @param {Element} hostElement DOM element to register grammar checking service for * @param {BesTAService} textAreaService