本文へ移動

Chikyu Earth地球

世界の国の輪郭を線で描いた地球儀です。地球と同じ速さで回ります。宇宙から見たような地球と、好きな場所の目印も使えます。

「地球」(ちきゅう) は、私たちが住む星の名前です。 名前について(英語)

目次

リファレンス · データの入口(自分で用意した地球の地図や軌道データを、ライセンスと出典つきのソースとして渡し、いま画面にあるのは誰のデータかを示します)

TileStore型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

A tile store: tiles by source and key, under one byte budget.

インポート

import type { TileStore } from "@johnmorrisdotca/chikyu-earth/door";

定義

interface TileStore<Tile> {
    want(source: TileLoader<Tile>, keys: readonly string[], again?: boolean): ReadonlyMap<string, Tile>;
    get(sourceId: string, key: string): Tile | undefined;
    drop(sourceId: string): void;
    stats(): TileStats;
    idle(): Promise<void>;
}

メンバー

名前型説明
want(source: TileLoader<Tile>, keys: readonly string[], again?: boolean): ReadonlyMap<string, Tile>

Tells the store which tiles source needs now, and returns the ones it holds. When the keys are the same as the last call it does nothing, so a view that asks again at rest sends nothing; when they changed, the missing ones load (a tile that failed is tried again only now), the loads of tiles no longer needed are aborted, and the held ones are marked used. again: true is for a caller that means "try what is missing once more" with the same keys: it starts the missing tiles that are not already loading or waiting, and nothing else changes.

get(sourceId: string, key: string): Tile | undefined

One held tile, or undefined.

drop(sourceId: string): void

Forgets a source: aborts its loads, frees its tiles. The source is switched off.

stats(): TileStats
idle(): Promise<void>

Resolves when no load is running or waiting.

例

import type { TileStore } from "./data-door.ts";

const held = (store: TileStore<Uint8Array>): number => store.stats().held;

ソースを見るGitHub で編集@johnmorrisdotca/chikyu-earth 0.51.1 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。