Utilities
Clipboard, download, theme and collection helpers — all real browser APIs under a consistent F.* surface.
copy
js
await F.copy("npm install flash.js");
F.toast("Copied!", "success");
// standalone ESM
import { copy } from "flash.js/utils"; // or from "flash.js"
await copy("hello");Uses navigator.clipboard.writeText with <textarea> + execCommand fallback.
download
js
F.download("hello.txt", "Hello, FLASH.js!", "text/plain");
F.download("data.json", JSON.stringify(data, null, 2), "application/json");
F.download("image.png", blob, "image/png"); // Blob also acceptedtheme
js
F.theme("dark"); // → <html data-theme="dark"> + localStorage + event
F.theme("light");
F.theme(); // "dark" | "light"
F.theme("system"); // site helper resolves to system preference
document.addEventListener("flash:theme", (e) => console.log(e.detail));This site persists theme via F.storage.set("flash:site-theme", mode) and restores on load — see src/js/site.js:1.
each / map / filter / extend / type / isEmpty
js
F.each([1,2,3], (i, v) => console.log(i, v));
F.each({ a: 1 }, (k, v) => console.log(k, v));
F.map([1,2,3], v => v * 2);
F.filter([1,2,3], v => v > 1);
F.extend({}, a, b);
F.type([]); // "array"
F.isEmpty({}); // trueLive demo
—