本文へ移動

Hoshi Stars星

肉眼で見える星の名前・色・距離、88星座の線と境界、メシエ天体、そしてそれらを描くための7種類の図法を使えます。

「星」(ほし) は、夜空に光って見えるものです。 名前について(英語)

目次

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

TileStore型

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

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

インポート

import type { TileStore } from "@johnmorrisdotca/hoshi-stars/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/hoshi-stars 0.47.0 のソースから作成しました。

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