[claude] Add JSDoc types to all function parameters (#144) (#168)
Some checks failed
Deploy Nexus / deploy (push) Has been cancelled

This commit was merged in pull request #168.
This commit is contained in:
2026-03-24 04:04:08 +00:00
parent 7eca0fba5d
commit 316ce63605

24
app.js
View File

@@ -61,6 +61,10 @@ scene.add(stars);
// === CONSTELLATION LINES ===
// Connect nearby stars with faint lines, limited to avoid clutter
/**
* Builds constellation line segments connecting nearby stars.
* @returns {THREE.LineSegments}
*/
function buildConstellationLines() {
const linePositions = [];
const MAX_CONNECTIONS_PER_STAR = 3;
@@ -80,7 +84,7 @@ function buildConstellationLines() {
}
// Sort by distance and connect closest ones
neighbors.sort((a, b) => a.dist - b.dist);
neighbors.sort((/** @type {{j: number, dist: number}} */ a, /** @type {{j: number, dist: number}} */ b) => a.dist - b.dist);
const toConnect = neighbors.slice(0, MAX_CONNECTIONS_PER_STAR - connectionCount[i]);
for (const { j } of toConnect) {
@@ -114,7 +118,7 @@ let mouseY = 0;
let targetRotX = 0;
let targetRotY = 0;
document.addEventListener('mousemove', (e) => {
document.addEventListener('mousemove', (/** @type {MouseEvent} */ e) => {
mouseX = (e.clientX / window.innerWidth - 0.5) * 2;
mouseY = (e.clientY / window.innerHeight - 0.5) * 2;
});
@@ -129,6 +133,10 @@ window.addEventListener('resize', () => {
// === ANIMATION LOOP ===
const clock = new THREE.Clock();
/**
* Main animation loop — called each frame via requestAnimationFrame.
* @returns {void}
*/
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
@@ -164,10 +172,10 @@ document.getElementById('debug-toggle').addEventListener('click', () => {
if (debugMode) {
// Example: Visualize all collision boxes and light sources
// Replace with actual logic when available
document.querySelectorAll('.collision-box').forEach(el => el.style.outline = '2px solid red');
document.querySelectorAll('.light-source').forEach(el => el.style.outline = '2px dashed yellow');
document.querySelectorAll('.collision-box').forEach((/** @type {HTMLElement} */ el) => el.style.outline = '2px solid red');
document.querySelectorAll('.light-source').forEach((/** @type {HTMLElement} */ el) => el.style.outline = '2px dashed yellow');
} else {
document.querySelectorAll('.collision-box, .light-source').forEach(el => {
document.querySelectorAll('.collision-box, .light-source').forEach((/** @type {HTMLElement} */ el) => {
el.style.outline = 'none';
});
}
@@ -178,15 +186,15 @@ import { wsClient } from './ws-client.js';
wsClient.connect();
window.addEventListener('player-joined', (event) => {
window.addEventListener('player-joined', (/** @type {CustomEvent} */ event) => {
console.log('Player joined:', event.detail);
});
window.addEventListener('player-left', (event) => {
window.addEventListener('player-left', (/** @type {CustomEvent} */ event) => {
console.log('Player left:', event.detail);
});
window.addEventListener('chat-message', (event) => {
window.addEventListener('chat-message', (/** @type {CustomEvent} */ event) => {
console.log('Chat message:', event.detail);
});