This playground demonstrates the whenwords library implemented in WebAssembly Text Format (WAT) - a low-level stack-based esoteric language.
The WASM module computes time calculations natively, while JavaScript handles string formatting.
Convert a timestamp to a human-readable relative time string.
Format a number of seconds as a human-readable duration.
WAT (WebAssembly Text Format) is the human-readable text representation of WebAssembly.
The core numeric logic (calculating time differences, thresholds, and values) runs entirely in the WebAssembly module. The WASM returns codes and computed values, which JavaScript then formats into human-readable strings.
WAT features used:
(func ...) - Function definitions(param i32) - 32-bit integer parameters(local.get/set) - Local variable access(global.get/set) - Global state managementi32.sub, i32.div_s, i32.rem_s - Integer arithmetic(if ... (then ...) (else ...)) - Conditional branching(memory ...) - Linear memory for data storagei32.store, i32.load - Memory operations