documentation for promises.when function?

I am trying to understand some code for horizon chart seen here Realtime horizon chart / D3 | Observable

In it they had a block below

const period = 250, m = data[0].length;
const tail = data.map(d => d.subarray(m - 1, m));
while (true) {
    const then = new Date(Math.ceil((Date.now() + 1) / period) * period);
    yield Promises.when(then, then);
    for (const d of data) d.copyWithin(0, 1, m), d[m - 1] = walk(d[m - 1]);
        chart.update(tail, {then, period});
}

I was trying to find some documentation about the Promises.when(then, then) function to understand what it does. The only thing that I found was this introduction to promises article but it has no mention of when function.

Today is the first time finding observable trying to understand the above chart visualization, if anyone can point me to the right direction to understanding “promises” I would greatly appreciated.

As a side note I had a very frustrating experience trying to find anything on google about this. It’s really difficult when the keywords are observable, promises, and when…even with quotations I got nothing really informative.

This is part of the Observable standard library, see Standard library / Observable | Observable for details.

To add, Promise (singular) is the native object. Observable’s Standard Library uses Promises (plural) to distinguish the added methods.

Adding “observablehq” instead of “observable” to your searches should yield you better results, e.g.