Menu

Migration from jQuery

FLASH.js keeps the DX you love — $(".card").addClass("active") → F(".card").addClass("active") — but embraces the modern platform.

jQuery$ → FESM
Philosophy: No claim of 100% compatibility. FLASH.js intentionally diverges where the platform now has a better primitive (e.g., fetch over $.ajax).

Side-by-side

jQueryFLASH.js
$(selector)F(selector) — Flash is alias; F is primary
$(".card").addClass("a")F(".card").addClass("a")
$el.html() / text() / val()F(el).html() / text() / val()
$el.attr(k,v) / removeAttrF(el).attr(k,v) / removeAttr
$el.on("click", fn)F(el).on("click", fn)
$(document).on("click",".btn", fn)F(document).on("click",".btn", fn)
$el.trigger("evt")F(el).trigger("evt", detail)
$el.animate(props, opts) — jQuery FXF(el).animate(keyframes, opts) — Web Animations API
$.ajax({ url, method })await F.http.get("/api") / F.http.json() / F.http.request()
localStorage manual JSONF.storage.set/get/has — JSON auto

Key differences

  • ESM: import { F } from "flash.js" instead of global $. UMD global still available as F/Flash for migration.
  • Fetch: F.http throws on non-2xx; handle via catch and error.status — no success/error callbacks.
  • Animation: Keyframes use Web Animations API syntax { opacity: [0,1] } or arrays; always returns Promise.
  • No Sizzle: selectors are native querySelectorAll — no jQuery custom pseudos.
  • Collection vs jQuery object: FLASH's Collection is iterable and array-like; use get(), each, map, filter.

ESM & tree-shaking

js
// Before
import $ from "jquery";
$(".card").addClass("active");

// After — ESM + tree-shaking
import { F } from "flash.js";
F(".card").addClass("active");

// Only what you use
import { http } from "flash.js/http";

Compatibility note

FLASH.js is not a drop-in jQuery shim. Porting is usually search-and-replace for DOM/events, but HTTP and animation need small rewrites to modern APIs. The docs' API reference is exactly the implemented surface — no hidden shims.

API Reference →

⌕