API Reference
Exactly the implemented surface — flash.js:1 + src/ ESM. No fake APIs. Verify via flash.d.ts.
Collection
F(selector) returns Collection — iterable, array-like, chainable.
| Method | Signature | Notes |
get | get(i?: number) → Element|Element[] | get() all, get(-1) last |
each | each(fn: (i, el)) → this | fn.call(el, i, el) |
map / filter / first / last / eq | — | Returns new Collection / array |
F
| API | Description |
F(target: string|Element|NodeList|Collection|Window|Document|Function) | Selector / HTML string / wrap / ready sugar |
F.ready(cb) | DOMContentLoaded or immediate |
F.version | "1.0.0" |
F.Collection | Class reference |
DOM
| Method | Signature |
html | html() → string | html(value: string|Element|Collection) → this |
text | text() → string | text(value) → this |
val | val() → string | val(value) → this |
addClass / removeClass / toggleClass / hasClass | addClass(...names) → this |
attr / removeAttr / prop / removeProp / data / removeData | attr(name, value?), data auto JSON |
css | css(prop, value) | css({}) — getter uses getComputedStyle |
show / hide / toggle | show(display="") → this |
append / prepend / before / after / remove / empty / clone | Accepts string (HTML fragment), Element, Collection |
find / parent / parents / children / closest / siblings / next / prev / is / index | Traversal — all return Collection / boolean / number |
Events
| Method | Usage |
on | on(events, handler, opts?) or on(events, selector, handler, opts?) delegation |
off | off(events?, handler?) |
one | one(events, handler) once |
trigger | trigger(event: string|Event, detail?) |
Effects
| Method | Signature |
animate | animate(keyframes, options?: number|KeyframeAnimationOptions) → Promise<this> |
fadeIn / fadeOut | fadeIn(duration=300) → Promise |
slideDown / slideUp | slideDown(duration=300) → Promise |
observe / visible / resize | Returns native observer instances |
HTTP — F.http
| Method | Description |
request(url, options?) | fetch + json sugar + timeout via AbortController; throws on !ok with status |
json / text / blob / arrayBuffer | json(url, options?) → Promise<T> |
get / post / put / patch / delete | Convenience wrappers |
Storage — F.storage
| Method | Description |
get / set / has / remove / clear | localStorage JSON wrapper |
session.* | sessionStorage variant |
Observers
Collection methods: observe(cb, opts?), visible(cb, opts?), resize(cb, opts?). Standalone via flash.js/observers.
UI — F.toast / modal / alert / confirm / loading
| API | Signature |
toast | toast(message, type|string|{type,duration}) → HTMLElement |
modal | modal({ title?, message?, actions: {label,value,variant}[], closeOnBackdrop? }) → Promise<value|null> |
alert | alert(message, title?) → Promise<true|null> |
confirm | confirm(message, title?) → Promise<boolean|null> |
loading | loading(show?: boolean) — ref-counted |
Utilities — F.copy / download / theme / etc
| API | Signature |
copy | copy(text) → Promise<true> clipboard with fallback |
download | download(filename, data: Blob|string, mime?) |
theme | theme(mode?: "light"|"dark"|"system") → string + localStorage + flash:theme event |
each / map / filter / extend / unique / toArray / type / isEmpty | Collection-agnostic helpers |
Full types in flash.d.ts:1. Library is src/index.js:1 + flash.js:1 — imports used by this site are exactly these.