Hi,
I'm using this example
window.addEventListener("load", () => {
const canvas = <HTMLCanvasElement>document.getElementById("animation");
const player = new a.AnimationPlayer(canvas);
player.Resize(800, 600);
player.Play(Animation);
});
async function* Animation(c) {
const square = new f.Rect(0, 0, 30, 30, a.HexColor("#000000"));
for await (let n of context.delayedGenerator({ generator: app.naturals })) {
square.x = n * 10
square.y = 1
yield square;
}
}
DelayedGenerator just adds a sleep to a normal generator. This is how I implemented it:
public async *delayedGenerator({ generator }: { generator: any }): AsyncGenerator<any, void, unknown> {
const combined = (function* (genA: any, genB: any) {
let nextGenA: any, nextGenB: any;
while (!(nextGenA = genA.next()).done && !(nextGenB = genB.next()).done) {
yield { a: nextGenA.value, b: nextGenB.value };
}
})(generator(), this.authority(this));
for (let wee_wee of combined) {
yield Promise.all([wee_wee.a, wee_wee.b]);
}
}
My issue as you can see is that it is a AsyncGenerator and not a Generator ! Which is not accepted !
How to resolve this.
Hi,
I'm using this example
DelayedGenerator just adds a sleep to a normal generator. This is how I implemented it:
My issue as you can see is that it is a AsyncGenerator and not a Generator ! Which is not accepted !
How to resolve this.