MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / constructor

Method constructor

packages/playground/src/components/TimeSlider.ts:19–40  ·  view source on GitHub ↗
(api: alphaTab.AlphaTabApi)

Source from the content-addressed store, hash-verified

17 private unsubPosition: () => void;
18
19 constructor(api: alphaTab.AlphaTabApi) {
20 this.root = parseHtml(html`
21 <div class="at-time-slider-wrap">
22 <div class="cmp-progress"></div>
23 </div>
24 `);
25 this.bar = mount(this.root, '.cmp-progress', new ProgressBar());
26 this.bar.onClickPercent = percent => {
27 if (this.endTime > 0) {
28 api.timePosition = Math.floor(this.endTime * percent);
29 }
30 };
31
32 this.unsubMidiLoaded = api.midiLoaded.on(e => {
33 this.endTime = e.endTime;
34 });
35 this.unsubPosition = api.playerPositionChanged.on(args => {
36 if (args.endTime > 0) {
37 this.bar.setValue(args.currentTime / args.endTime);
38 }
39 });
40 }
41
42 dispose(): void {
43 this.unsubMidiLoaded();

Callers

nothing calls this directly

Calls 6

parseHtmlFunction · 0.90
htmlFunction · 0.90
mountFunction · 0.90
floorMethod · 0.80
onMethod · 0.65
setValueMethod · 0.45

Tested by

no test coverage detected