Skip to the content

Chikyu Earth地球

A line-drawn globe of the world's countries that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place.

Chikyu is the Japanese word 地球 for the Earth. About the name

Contents

Reference · The realistic Earth's pure parts

createGatefunction

A rate gate for the draw: asks that come faster than minMs apart become one, and the last ask is never lost, so a burst of changes costs one draw.

Import it

import { createGate } from "@johnmorrisdotca/chikyu-earth/realistic";

Definition

function createGate(minMs: number, fire: () => void, timers?: Timers): Gate

Parameters

NameTypeDescription
minMsnumber

The least time between two runs, in milliseconds.

fire() => void

What to run.

timers (optional)Timers

A clock and timers; the browser's by default (a test passes its own).

Returns

Gate

The gate: request() to ask, cancel() to forget a waiting run, setMinMs() to change the pace.

Examples

import { createGate } from "@johnmorrisdotca/chikyu-earth/realistic";

const gate = createGate(30, () => console.log("drawn"));
gate.request();
gate.request();
gate.request();
gate.cancel();
drawn

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chikyu-earth 0.11.0.