Skip to content

Commit

Permalink
fix (web): Fix a bunch of TS style issues identified by tseslint
Browse files Browse the repository at this point in the history
  • Loading branch information
vorburger committed Jan 15, 2025
1 parent f22efb2 commit ef8011b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions web/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import Graph from "graphology"
import { parse } from "graphology-gexf/browser"
import { random } from "graphology-layout"
import forceAtlas2, { inferSettings } from "graphology-layout-forceatlas2"
import random from "graphology-layout/random"
import { Sigma } from "sigma"

function getElementByIdOrFail(id: string): HTMLElement {
Expand Down Expand Up @@ -72,20 +72,21 @@ fetch("/gexf?q=enola:/inline") // TODO "enola.gexf" for easy Dev mode?! Nah, let

// Bind zoom manipulation buttons
zoomInBtn.addEventListener("click", () => {
camera.animatedZoom({ duration: 600 })
void camera.animatedZoom({ duration: 600 })
})
zoomOutBtn.addEventListener("click", () => {
camera.animatedUnzoom({ duration: 600 })
void camera.animatedUnzoom({ duration: 600 })
})
zoomResetBtn.addEventListener("click", () => {
camera.animatedReset({ duration: 600 })
void camera.animatedReset({ duration: 600 })
})

// Bind labels threshold to range input
labelsThresholdRange.addEventListener("input", () => {
renderer?.setSetting("labelRenderedSizeThreshold", +labelsThresholdRange.value)
renderer.setSetting("labelRenderedSizeThreshold", +labelsThresholdRange.value)
})

// Set proper range initial value:
labelsThresholdRange.value = renderer.getSetting("labelRenderedSizeThreshold") + ""
labelsThresholdRange.value = renderer.getSetting("labelRenderedSizeThreshold").toString()
})
.catch(console.error)
2 changes: 1 addition & 1 deletion web/src/string2long.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from "@jest/globals"
import { StringToLongBiMap } from "./string2long"
import { StringToLongBiMap } from "./string2long.js"

describe("StringToLongBiMap", () => {
it("should add and retrieve symbols correctly", () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/string2long.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class StringToLongBiMap {
if (id >= 0 && id < this.symbolsList.length) {
return this.symbolsList[id]
} else {
throw new Error(`ID not found: ${id}`)
throw new Error(`ID not found: ${id.toString()}`)
}
}

Expand Down

0 comments on commit ef8011b

Please sign in to comment.