Experiment 02 · Async Generators · More generators

Sequences of 2-tuples (2D coordinate) and 3-tuples (3D coordinate), to play with. Here again, every value is delivered delayed by the generator functions and results are aggregated by the worker, and sent back as an array. The noise matrix represents values of a two-dimensional of Perlin noise map.

const worker = new Worker( "worker.js");
worker.postMessage( { name: "helix", op: "helix", args: [ 5, 10, 20, 0, 6 * Math.PI, 10 ] });
worker.postMessage( { name: "felix", op: "felix", args: [ 11, 20, 1, 250 ] });
worker.postMessage( { name: "zelig", op: "zelig", args: [ 1, 100, 5, 400 ] });
worker.postMessage( { name: "noise", op: "noise", args: [ 0, 1, 0.2, 100 ] });

Supported by Safari 12 and Firefox 64 and Chrome 71 out-of-the box.