Skip to content

Commit 787f660

Browse files
committed
Merge branch 'antonmak1-update-cample'
2 parents 9d6f9e3 + da5d43a commit 787f660

File tree

4 files changed

+66
-62
lines changed

4 files changed

+66
-62
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ This will take some time (currently about 12 hours on my machine). Finally creat
103103
npm run results
104104
```
105105

106-
Open js-framework-benchmark/webdriver-ts-results/table.html in a browser and take a look at the results. You can open the result table with the link [http://localhost:8080/webdriver-ts-results/dist/index.html](http://localhost:8080/webdriver-ts-results/dist/index.html)
106+
Open js-framework-benchmark/webdriver-ts-results/table.html in a browser and take a look at the results. You can open the result table with the link [http://localhost:8080/webdriver-ts-results/table.html](http://localhost:8080/webdriver-ts-results/table.html)
107107

108108

109109
Here's what you should do when the benchmark run was not successful. Let's assume the benchmark printed the following to the console:

frameworks/keyed/cample/package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/keyed/cample/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-framework-benchmark-cample",
3-
"version": "3.2.0-beta.1",
3+
"version": "3.2.0-beta.2",
44
"description": "cample demo",
55
"main": "dist/main.js",
66
"js-framework-benchmark": {
@@ -29,6 +29,6 @@
2929
"webpack-cli": "5.0.1"
3030
},
3131
"dependencies": {
32-
"cample": "3.2.0-beta.1"
32+
"cample": "3.2.0-beta.2"
3333
}
3434
}

frameworks/keyed/cample/src/main.js

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -106,27 +106,27 @@ const mainComponent = component(
106106
<div class="jumbotron">
107107
<div class="row">
108108
<div class="col-md-6">
109-
<h1>cample-"keyed"</h1>
109+
<h1>cample-"keyed"</h1>
110110
</div>
111111
<div class="col-md-6">
112112
<div class="row">
113113
<div class="col-sm-6 smallpad">
114-
<button type='button' class='btn btn-primary btn-block' id='run'>Create 1,000 rows</button>
114+
<button type='button' class='btn btn-primary btn-block' :click="{{run()}}" id='run'>Create 1,000 rows</button>
115115
</div>
116116
<div class="col-sm-6 smallpad">
117-
<button type='button' class='btn btn-primary btn-block' id='runlots'>Create 10,000 rows</button>
117+
<button type='button' class='btn btn-primary btn-block' :click="{{runLots()}}" id='runlots'>Create 10,000 rows</button>
118118
</div>
119119
<div class="col-sm-6 smallpad">
120-
<button type='button' class='btn btn-primary btn-block' id='add'>Append 1,000 rows</button>
120+
<button type='button' class='btn btn-primary btn-block' :click="{{add()}}" id='add'>Append 1,000 rows</button>
121121
</div>
122122
<div class="col-sm-6 smallpad">
123-
<button type='button' class='btn btn-primary btn-block' id='update'>Update every 10th row</button>
123+
<button type='button' class='btn btn-primary btn-block' :click="{{update()}}" id='update'>Update every 10th row</button>
124124
</div>
125125
<div class="col-sm-6 smallpad">
126-
<button type='button' class='btn btn-primary btn-block' id='clear'>Clear</button>
126+
<button type='button' class='btn btn-primary btn-block' :click="{{clear()}}" id='clear'>Clear</button>
127127
</div>
128128
<div class="col-sm-6 smallpad">
129-
<button type='button' class='btn btn-primary btn-block' id='swaprows'>Swap Rows</button>
129+
<button type='button' class='btn btn-primary btn-block' :click="{{swapRows()}}" id='swaprows'>Swap Rows</button>
130130
</div>
131131
</div>
132132
</div>
@@ -144,57 +144,61 @@ const mainComponent = component(
144144
selected: null,
145145
};
146146
},
147-
functions: {
147+
dataFunctions: {
148148
updateRows: "rows",
149149
updateSelected: "selected",
150150
},
151-
script: [
152-
({ functions, elements }) => {
153-
const addListener = (key, fn) => {
154-
elements[key].addEventListener("click", () => {
155-
functions.updateRows(fn);
151+
functions: {
152+
run: [
153+
(setData) => () => {
154+
setData(() => buildData(1000));
155+
},
156+
"updateRows",
157+
],
158+
runLots: [
159+
(setData) => () => {
160+
setData(() => buildData(10000));
161+
},
162+
"updateRows",
163+
],
164+
add: [
165+
(setData) => () => {
166+
setData((d) => [...d, ...buildData(1000)]);
167+
},
168+
"updateRows",
169+
],
170+
update: [
171+
(setData) => () => {
172+
setData((d) => {
173+
const value = d.slice();
174+
for (let i = 0; i < value.length; i += 10) {
175+
const item = value[i];
176+
value[i] = { ...item, label: item.label + " !!!" };
177+
}
178+
return value;
156179
});
157-
};
158-
addListener("run", () => {
159-
return buildData(1000);
160-
});
161-
addListener("runLots", () => {
162-
return buildData(10000);
163-
});
164-
addListener("add", (d) => {
165-
return [...d, ...buildData(1000)];
166-
});
167-
addListener("update", (d) => {
168-
const value = d.slice();
169-
for (let i = 0; i < value.length; i += 10) {
170-
const item = value[i];
171-
value[i] = { ...item, label: item.label + " !!!" };
172-
}
173-
return value;
174-
});
175-
addListener("clear", () => {
176-
return [];
177-
});
178-
addListener("swapRows", (d) => {
179-
const value = d.slice();
180-
const tmp = value[1];
181-
value[1] = value[998];
182-
value[998] = tmp;
183-
return value;
184-
});
185-
},
186-
{
187-
start: "afterLoad",
188-
elements: {
189-
run: "#run",
190-
runLots: "#runlots",
191-
add: "#add",
192-
update: "#update",
193-
clear: "#clear",
194-
swapRows: "#swaprows",
195180
},
196-
},
197-
],
181+
"updateRows",
182+
],
183+
clear: [
184+
(setData) => () => {
185+
setData(() => []);
186+
},
187+
"updateRows",
188+
],
189+
swapRows: [
190+
(setData) => () => {
191+
setData((d) => {
192+
const value = d.slice();
193+
const tmp = value[1];
194+
value[1] = value[998];
195+
value[998] = tmp;
196+
return value;
197+
});
198+
},
199+
"updateRows",
200+
],
201+
},
198202
export: {
199203
tableData: {
200204
data: {

0 commit comments

Comments
 (0)