StarSkytype
The faint stars of a page from any number of sources: loads the tiles a patch needs from each and answers from the ones it has. With only ucac4Source it is faintSky.
Import it
import type { StarSky } from "@johnmorrisdotca/hoshi-stars/door";
Definition
interface StarSky {
readonly sources: readonly StarSource[];
addSource(source: StarSource): () => void;
removeSource(id: string): boolean;
enable(id: string, on: boolean): void;
ownOnly(on: boolean): void;
load(field: FaintField, limit?: number): Promise<void>;
stars(field: FaintField, limit?: number, max?: number): {
stars: FaintStar[];
depth: number;
loaded: boolean;
};
credits(): Credit[];
readonly size: number;
stats(): TileStats & {
skipped: number;
};
}
Members
| Name | Type | Description |
|---|---|---|
sources | readonly StarSource[] | The sources now in the view, in the order added. |
addSource | (source: StarSource): () => void | Adds a source. It throws a |
removeSource | (id: string): boolean | Removes a source by id: aborts its loads, frees its tiles, drops its credit. Returns whether there was one. |
enable | (id: string, on: boolean): void | Switches a source off ( |
ownOnly | (on: boolean): void |
|
load | (field: FaintField, limit?: number): Promise<void> | Fetch the tiles the patch needs for stars to |
stars | (field: FaintField, limit?: number, max?: number): { stars: FaintStar[]; depth: number; loaded: boolean; } | The stars of the patch from the tiles that are here, brightest first, from all sources together (see |
credits | (): Credit[] | The sources that gave at least one star to the last |
size | number | How many tiles are here. |
stats | (): TileStats & { skipped: number; } | What the store has done (loads started, failed, refused, held bytes), and |
Examples
import { creditLine, starSky, ucac4Source, type StarSource } from "@johnmorrisdotca/hoshi-stars/door";
declare const mySource: StarSource;
const sky = starSky({ sources: [ucac4Source()] });
const remove = sky.addSource(mySource); // checked at once; returns the way to take it away
await sky.load({ rightAscension: 83.8, declination: -5.4, radius: 1 }, 12);
console.log(creditLine(sky.credits(), "en"));
remove();