リファレンス · データの入口(自分で用意した星やディープスカイ天体を、ライセンスと出典つきのソースとして渡し、いま画面にあるのは誰のデータかを示します)
createTileStore関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A tile store for a view: loads the tiles of every source by key and keeps them under one budget of bytes (default 48 MB, all sources together).
- At most
maxInFlightloads (6) run at once for a source, and a load starts only because the keys changed: at rest the store sends nothing, and a tile that failed waits for the next change. - The least recently used tile goes first when room is needed, and never a tile the view needs now. If a new tile does not fit even so, it is refused and counted: the held bytes never pass the budget (nor the count, if
maxTilesis set). - A tile that throws, comes back empty or reports a size that is not a finite number is counted in
failedand never held, so it is never drawn. drop(sourceId)aborts the source's loads and frees its tiles.
インポート
import { createTileStore } from "@johnmorrisdotca/hoshi-stars/door";
定義
function createTileStore<Tile>(options?: TileStoreOptions): TileStore<Tile>
引数
| 名前 | 型 | 説明 |
|---|---|---|
options (省略可) | TileStoreOptions | Budget, loads in flight, and a callback for a redraw. |
戻り値
TileStore<Tile>
The store.
例
import { createTileStore } from "./data-door.ts";
const store = createTileStore<Tile>({ onChange: draw });
const held = store.want(source, source.need(place, detail)); // draws what is held now; the rest arrives through onChange
store.drop(source.info.id); // the layer is switched offこの日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。