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 · Flags a page registers itself

FlagsRegisteredtype

What registering a set did: the flags added, the records left out with the reason each was (never drawn), and a way to take the set out again.

Import it

import type { FlagsRegistered } from "@johnmorrisdotca/hata/custom";

Definition

interface FlagsRegistered {
    status: "ok" | "failed" | "aborted";
    source: string;
    added: string[];
    skipped: number;
    rejected: {
        id: string | null;
        reason: string;
    }[];
    reason?: string;
    remove(): void;
}

Members

NameTypeDescription
status"ok" | "failed" | "aborted"

"ok", "failed" (the source threw, or gave a list over the limit: nothing added) or "aborted".

sourcestring

The source's id.

addedstring[]

The ids added, in order.

skippednumber

How many records were left out.

rejected{ id: string | null; reason: string; }[]

Each record left out, with its id as given (or null) and why.

reason (optional)string | undefined

Why a read failed.

remove(): void

Takes the whole set out again; the same as removeFlags(source).

Examples

import type { FlagsRegistered } from "@johnmorrisdotca/hata/custom";

const say = (done: FlagsRegistered): string => `${done.status}: ${done.added.length} added, ${done.rejected.length} left out`;
console.log(typeof say);
function

What it prints (run when this page was built)

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