Back to Powder Tool V600Billion
SOURCE / PINNED RELEASE

Made of little things.

Powder Tool V600Billion

Release
142767edcab8…
Author-recorded commit
6d92971effd0…
License
LICENSE
Author’s source reference
nostr://npub1fllw8kw0thjj55wds0uugcnp5kej2nfxd36eruq39d56wwz8r44q5q78wj/wss%3A%2F%2Fgit.napplet.soy%2F/powder-toy

Archive hash verified: ed7d6a8ea7083197…. The source-to-build association is the author’s claim; it has not been independently rebuilt.

source/src/toast.js
/** Short notices over the game, in the page's own HTML (the game's UI is not ours to change). */
export function toast(text, { action, timeoutMs = 6000 } = {}) {
  const box = document.getElementById('toasts');
  if (!box) return () => {};
  const item = document.createElement('div');
  item.className = 'toast';
  item.textContent = text;
  if (action) {
    const button = document.createElement('button');
    button.type = 'button';
    button.textContent = action.label;
    button.addEventListener('click', () => { action.run(); close(); });
    item.append(button);
  }
  box.append(item);
  let timer = timeoutMs > 0 ? setTimeout(() => close(), timeoutMs) : null;
  function close() {
    if (timer) clearTimeout(timer);
    timer = null;
    item.remove();
  }
  return close;
}