javascript

Just fixed the flickering issue by inlining the required JavaScript, which is a really small snippet. If you’re curious about the code I’m using to toggle between the dark and light themes, following the user’s choice and falling back to the OS settings, here it is:

const mql = window.matchMedia('(prefers-color-scheme: dark)');

function toggleT (to) {
  localStorage.setItem('t', to);
  theme(mql);
}

function theme (query) {
  const userOption = localStorage.getItem('t');

  document.body.id = userOption === null
    ? (query.matches ? 'dark' : '')
    : (userOption === 'd' ? 'dark' : '');
}

mql.addListener(theme);
theme(mql);

Modularity for Everyone - James Halliday

So this talk was about modularity and how great it would be if we all created smaller modules for specific functions. Here’s some key aspects: Modules allow to reuse code easily. NPM modules can be used in both browser and node environments. He also talked about using NPM for modules of basically every language. It would be interesting if that happened, but for that to happen, a lot would need to change.