1234567891011121314151617181920212223242526272829303132333435363738394041 |
- module.exports = class StatusBarManager {
- constructor () {
- this.span = document.createElement('span')
- this.element = document.createElement('div')
- this.element.id = 'status-bar-auto-highlight'
- this.element.className = 'block'
- this.element.appendChild(this.span)
- this.container = document.createElement('div')
- this.container.className = 'inline-block'
- this.container.appendChild(this.element)
- }
- initialize (statusBarService) {
- this.statusBarService = statusBarService
- }
- update (count) {
- this.span.className = atom.config.get('auto-highlight.countDisplayStyles')
- this.span.textContent = count
- this.element.style.display = 'inline-block'
- }
- clear () {
- this.element.style.display = 'none'
- }
- attach () {
- const displayPosition = atom.config.get('auto-highlight.countDisplayPosition')
- this.tile = this.statusBarService[`add${displayPosition}Tile`]({
- item: this.container,
- priority: atom.config.get('auto-highlight.countDisplayPriority')
- })
- }
- detach () {
- if (this.tile) this.tile.destroy()
- }
- }
|