Reference · On-demand flag loading
LoadedFlagOntype
What flagOn() gives: FlagOnDay from /manifest (the flag of the day with other, withheld and none), and its drawing.
Import it
import type { LoadedFlagOn } from "@johnmorrisdotca/hata/load";
Definition
interface LoadedFlagOn extends FlagOnDay {
svg: string | null;
}
Members
| Name | Type | Description |
|---|---|---|
svg | string | null | The drawing, framed as asked; null where there is none to give: no flag known, or a restricted one withheld ( |
date | string | The day asked, |
role | FlagRole | The role asked. |
variant | DatedVariant | null | The flag, or null. |
none | NoFlag | null | Why there is no drawing to give; null where there is one. |
Examples
import { flagOn, type LoadedFlagOn } from "@johnmorrisdotca/hata/load";
const day: LoadedFlagOn = await flagOn("CA", "1962-09-29", { shape: "4:3" });
console.log(day.variant?.id, day.variant?.other?.id); // "union-flag" "red-ensign-1957"
console.log(day.svg?.startsWith("<svg")); // trueunion-flag red-ensign-1957
trueWhat it prints (run when this page was built)