Suppress error

This commit is contained in:
Romein van Buren 2022-07-13 12:23:54 +02:00
parent 0c88920f9e
commit 0aa3ce6e2a
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
3 changed files with 10 additions and 6 deletions

View File

@ -12,6 +12,8 @@
let time = ''; let time = '';
let globalData = {}; let globalData = {};
let resizeTimer; let resizeTimer;
let automaticallyProportionalised = false;
let hasData = false;
function onResize() { function onResize() {
clearTimeout(resizeTimer); clearTimeout(resizeTimer);
@ -26,7 +28,6 @@
const tileH = 300; const tileH = 300;
const availableCols = Math.floor(w / tileW); const availableCols = Math.floor(w / tileW);
const availableRows = Math.floor(h / tileH); const availableRows = Math.floor(h / tileH);
console.log(w, h, availableCols, availableRows);
settings.update({ settings.update({
cols: availableCols, cols: availableCols,
@ -87,8 +88,6 @@
} }
onMount(() => { onMount(() => {
proportionalGrid();
const ws = new WebSocket( const ws = new WebSocket(
window.location.href.replace('http', 'ws') + '/socket' window.location.href.replace('http', 'ws') + '/socket'
); );
@ -100,6 +99,11 @@
case 'data': case 'data':
globalData = data; globalData = data;
organiseGrid(); organiseGrid();
if (!automaticallyProportionalised) {
proportionalGrid();
automaticallyProportionalised = true;
}
hasData = true;
break; break;
case 'bell': case 'bell':
@ -119,7 +123,7 @@
settings.subscribe(s => { settings.subscribe(s => {
size = (s.cols || 4) * (s.rows || 3) - 1; size = (s.cols || 4) * (s.rows || 3) - 1;
organiseGrid(); if (hasData) organiseGrid();
}); });
return () => clearInterval(clockInterval); return () => clearInterval(clockInterval);

View File

@ -14,7 +14,7 @@ function createSettingsStore() {
function updateStorage(val) { function updateStorage(val) {
window.localStorage.setItem('statusdash', JSON.stringify({ window.localStorage.setItem('statusdash', JSON.stringify({
...defaults, ...defaults,
...JSON.stringify(val), ...val,
})); }));
s.set(val); s.set(val);
} }

View File

@ -40,7 +40,7 @@ async function build() {
}); });
const { output } = await bundle.generate({ const { output } = await bundle.generate({
sourcemap: true, sourcemap: false,
format: 'iife', format: 'iife',
name: 'app', name: 'app',
file: 'public/build/bundle.js', file: 'public/build/bundle.js',