Changeset - 6c6b29d21959
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 20 months ago 2023-06-04 00:54:27
drewp@bigasterisk.com
carefully rm parameter
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
light9/ascoltami/Light9AscoltamiUi.ts
Show inline comments
 
@@ -251,25 +251,25 @@ export class Light9AscoltamiUi extends L
 
    try {
 
      const h1 = document.querySelector("h1")!;
 
      h1.innerText = h1.innerText.replace("{{host}}", config.host);
 
    } catch (e) {}
 
    byId("nav").innerText = navigator.userAgent;
 
    var updateFreq = navigator.userAgent.indexOf("Linux") != -1 ? 10 : 2;
 
    if (navigator.userAgent.match(/Windows NT/)) {
 
      // helper laptop
 
      updateFreq = 10;
 
    }
 
    byId("updateReq").innerText = "" + updateFreq;
 

	
 
    (window as any).finishOldStyleSetup(this.times, updateFreq, this.onOldStyleUpdate.bind(this));
 
    (window as any).finishOldStyleSetup(this.times, this.onOldStyleUpdate.bind(this));
 
  }
 

	
 
  onOldStyleUpdate(data: TimingUpdate) {
 
    this.nextText = data.next;
 
    this.isPlaying = data.playing;
 
    this.currentDuration = data.duration;
 
    this.song = new NamedNode(data.song);
 
    this.overviewZoom = { duration: data.duration, t1: 0, t2: data.duration };
 
    const t1 = data.t - 2,
 
      t2 = data.t + 20;
 
    this.zoom = { duration: data.duration, t1, t2 };
 
    const timeRow = this.shadowRoot!.querySelector(".timeRow") as HTMLDivElement;
light9/ascoltami/main.ts
Show inline comments
 
@@ -4,25 +4,25 @@ function byId(id: string): HTMLElement {
 

	
 
export interface TimingUpdate {
 
  // GET /ascoltami/time response
 
  duration: number;
 
  next: string; // e.g. 'play'
 
  playing: boolean;
 
  song: string;
 
  started: number; // unix sec
 
  t: number; // seconds into song
 
  state: { current: { name: string }; pending: { name: string } };
 
}
 

	
 
(window as any).finishOldStyleSetup = async (times: { intro: number; post: number }, updateFreq: number, timingUpdate: (data: TimingUpdate) => void) => {
 
(window as any).finishOldStyleSetup = async (times: { intro: number; post: number }, timingUpdate: (data: TimingUpdate) => void) => {
 
  let currentHighlightedSong = "";
 
  // let lastPlaying = false;
 

	
 
  
 
  const events = new EventSource("api/time/stream");
 
  events.addEventListener("message", (m)=>{
 
    const update = JSON.parse(m.data) as TimingUpdate
 
    updateCurrent(update)
 
    markUpdateTiming();
 
  })
 

	
 
  async function updateCurrent(data:TimingUpdate) {
0 comments (0 inline, 0 general)