Skip to the content

Hata旗

Load a native country or region flag, choose supported framing and keep each drawing’s source, author and licence.

Hata (旗) is Japanese for a flag. About the name

Contents

Reference · Native flag element

FlagElementEventDetailtype

What hata-load and hata-error carry in detail: the code as asked, and for an error why nothing was drawn.

Import it

import type { FlagElementEventDetail } from "@johnmorrisdotca/hata/element";

Definition

interface FlagElementEventDetail {
    code: string;
    shape: string;
    reason?: string;
}

Members

NameTypeDescription
codestring

The code, as the code attribute has it.

shapestring

The shape it was drawn at: own, 4:3, 1:1 or round.

reason (optional)string | undefined

For hata-error: why nothing was drawn.

Examples

import type { FlagElementEventDetail } from "@johnmorrisdotca/hata/element";

console.log(document.addEventListener("hata-error", (event) => {
  const { code, reason } = (event as CustomEvent<FlagElementEventDetail>).detail;
  console.log(code, reason);
}));

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hata 1.6.0.