Reference · Samurai battle banners
samuraiFlagfunction
A banner as an SVG string: it has a viewBox and no width or height, a tall nobori, a flag or the sign of a commander. frame() and
toDataUri() from the main entry take it like any other.
Import it
import { samuraiFlag } from "@johnmorrisdotca/hata/samurai";
Definition
function samuraiFlag(id: string): Promise<string | null>
Parameters
| Name | Type | Description |
|---|---|---|
id | string | A banner's id, in any case, with or without |
Returns
Promise<string | null>
The SVG string, loaded when it is asked for (the drawing is a module of its own, so a page carries only the drawings it asks for), or null when the set has no such banner.
Examples
import { toDataUri } from "@johnmorrisdotca/hata";
import { samuraiFlag } from "@johnmorrisdotca/hata/samurai";
const nobori = await samuraiFlag("samurai:sanada-rokumonsen"); // "<svg …>"
console.log(nobori === null ? null : toDataUri(nobori)?.startsWith("data:image/svg+xml,"));trueWhat it prints (run when this page was built)