From 70720a375f9c110fd031dea06b72c079a92f9335 Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Tue, 27 Feb 2018 14:42:11 +0000 Subject: [PATCH] refactor(examples): minor updates --- examples/cellular-automata/src/index.ts | 2 +- examples/hdom-benchmark/src/index.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/cellular-automata/src/index.ts b/examples/cellular-automata/src/index.ts index 00e240bcd0..3d8fc01d9b 100644 --- a/examples/cellular-automata/src/index.ts +++ b/examples/cellular-automata/src/index.ts @@ -25,7 +25,7 @@ const presets: DropDownOption[] = [ ["000111111000001111", "maze #2"], ["000001111111111110", "dots"], ["000101111000001111", "growth"], - ["000001011001011111", "organic"], + ["000001111000011111", "organic"], ["000010011000011111", "angular"], ]; diff --git a/examples/hdom-benchmark/src/index.ts b/examples/hdom-benchmark/src/index.ts index dbef11c91f..d6730fd94e 100644 --- a/examples/hdom-benchmark/src/index.ts +++ b/examples/hdom-benchmark/src/index.ts @@ -13,9 +13,9 @@ const hex6 = tx.hex(6); * * @param id */ -const box = (id: number) => [ +const box = (index: number, id: number) => [ (id & 1) ? "div" : "box", - { style: { background: "#" + hex6((id & 0x1ff) << 15 | id << 10 | id) } }, + { key: index, style: { background: "#" + hex6((id & 0x1ff) << 15 | id << 10 | id) } }, hex4(id & 0xffff) ]; @@ -99,8 +99,9 @@ const app = () => { let j = (++i) & 0x1ff; return ["div", ["div#stats", fps, menu], - tx.transduce(tx.map(box), tx.push(), ["grid"], tx.range(j, j + num))]; + ["grid", ...tx.iterator(tx.mapIndexed(box), tx.range(j, j + num))] + ]; }; }; -start(document.getElementById("app"), app()); +start(document.getElementById("app"), app(), false);