Skip to the content

Hoshi Stars星

The stars you can see without a telescope, with names, colours and distances; the 88 constellations with their lines and boundaries; the Messier objects; and seven map projections to draw them on.

Hoshi is the Japanese word 星 for a star. About the name

Contents

Reference · The data door: hand the package your own stars or objects as a source with its own licence and credit, and see whose data is on the screen

createTileStorefunction

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 maxInFlight loads (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 maxTiles is set).
  • A tile that throws, comes back empty or reports a size that is not a finite number is counted in failed and never held, so it is never drawn.
  • drop(sourceId) aborts the source's loads and frees its tiles.

Import it

import { createTileStore } from "@johnmorrisdotca/hoshi-stars/door";

Definition

function createTileStore<Tile>(options?: TileStoreOptions): TileStore<Tile>

Parameters

NameTypeDescription
options (optional)TileStoreOptions

Budget, loads in flight, and a callback for a redraw.

Returns

TileStore<Tile>

The store.

Examples

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

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hoshi-stars 0.47.0.