(options: ControlAppOptions = {})
| 108 | private unsubError: () => void; |
| 109 | |
| 110 | constructor(options: ControlAppOptions = {}) { |
| 111 | this.root = parseHtml(html` |
| 112 | <div class="at-wrap"> |
| 113 | <div class="cmp-overlay"></div> |
| 114 | <div class="at-content"> |
| 115 | <div class="cmp-sidebar"></div> |
| 116 | <div class="at-viewport"> |
| 117 | <div class="at-canvas"></div> |
| 118 | </div> |
| 119 | </div> |
| 120 | <div class="cmp-footer"></div> |
| 121 | <div class="cmp-selection-handles"></div> |
| 122 | </div> |
| 123 | `); |
| 124 | |
| 125 | const viewport = this.root.querySelector<HTMLElement>('.at-viewport')!; |
| 126 | const canvas = this.root.querySelector<HTMLElement>('.at-canvas')!; |
| 127 | const settings = buildSettings(options, viewport); |
| 128 | |
| 129 | this.api = new alphaTab.AlphaTabApi(canvas, settings); |
| 130 | this.unsubError = this.api.error.on(e => { |
| 131 | console.error('alphaTab error', e); |
| 132 | }); |
| 133 | |
| 134 | this.overlay = mount(this.root, '.cmp-overlay', new LoadingOverlay(this.api)); |
| 135 | this.sidebar = mount(this.root, '.cmp-sidebar', new Sidebar(this.api)); |
| 136 | this.footer = mount( |
| 137 | this.root, |
| 138 | '.cmp-footer', |
| 139 | new Footer(this.api, { trackList: this.sidebar.trackList }) |
| 140 | ); |
| 141 | this.selectionHandles = mount( |
| 142 | this.root, |
| 143 | '.cmp-selection-handles', |
| 144 | new SelectionHandles(this.api, viewport) |
| 145 | ); |
| 146 | this.crosshair = new Crosshair(); |
| 147 | this.dragDrop = new DragDrop(this.api, { |
| 148 | onEnter: () => this.overlay.enterDrag(), |
| 149 | onLeave: () => this.overlay.leaveDrag() |
| 150 | }); |
| 151 | this.nav = new NavMenu(); |
| 152 | document.body.appendChild(this.nav.root); |
| 153 | |
| 154 | // expose for fiddling in dev tools |
| 155 | if (typeof window !== 'undefined') { |
| 156 | window.api = this.api; |
| 157 | window.alphaTab = alphaTab; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | dispose(): void { |
| 162 | this.unsubError(); |
nothing calls this directly
no test coverage detected