Skip to content

Commit 6727420

Browse files
committed
Merge branch 'master' of https://github.com/ts-thomas/js-framework-benchmark into ts-thomas-master
2 parents 8c8d802 + 2ea4dda commit 6727420

File tree

14 files changed

+56
-61
lines changed

14 files changed

+56
-61
lines changed

frameworks/keyed/mikado-proxy/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<head>
44
<meta charset="utf-8"/>
55
<meta name="viewport" content="width=device-width">
6+
<link rel="preload" href="/css/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2" as="font" type="font/woff2" crossorigin>
7+
<link href="/css/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" media="screen">
8+
<link href="/css/main.css" rel="stylesheet" media="screen">
9+
<script src="dist/main.js" async></script>
610
<title>Mikado-Proxy-"keyed"</title>
7-
<link rel="preload" href="dist/main.js" as="script">
8-
<link href="/css/currentStyle.css" rel="stylesheet"/>
911
</head>
10-
<body>
11-
<script src="dist/main.js"></script>
12-
</body>
12+
<body></body>
1313
</html>

frameworks/keyed/mikado-proxy/package-lock.json

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

frameworks/keyed/mikado-proxy/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
},
1818
"scripts": {
1919
"compile": "npx mikado-compile --src src/template --type module -i -f && echo Compile Complete. && exit 0",
20-
"build": "npm run compile && node task/build RELEASE=custom DEBUG=false POLYFILL=false SUPPORT_CACHE=true SUPPORT_EVENTS=true SUPPORT_DOM_HELPERS=false SUPPORT_ASYNC=false SUPPORT_TRANSPORT=false SUPPORT_TEMPLATE_EXTENSION=false SUPPORT_REACTIVE=true REACTIVE_ONLY=true SUPPORT_CACHE_HELPERS=false SUPPORT_KEYED=true SUPPORT_POOLS=false SUPPORT_CALLBACKS=false SUPPORT_COMPILE=false && exit 0",
20+
"build": "npm run compile && node task/build RELEASE=custom DEBUG=false POLYFILL=false SUPPORT_CACHE=true SUPPORT_EVENTS=true SUPPORT_DOM_HELPERS=false SUPPORT_ASYNC=false SUPPORT_TRANSPORT=false SUPPORT_TEMPLATE_EXTENSION=false SUPPORT_REACTIVE=true REACTIVE_ONLY=true SUPPORT_CACHE_HELPERS=false SUPPORT_KEYED=true SUPPORT_POOLS=false SUPPORT_CALLBACKS=false SUPPORT_COMPILE=false SUPPORT_WEB_COMPONENTS=false && exit 0",
2121
"build-prod": "npm run build"
2222
},
2323
"dependencies": {
24-
"mikado": "^0.8.134"
24+
"mikado": "^0.8.213"
2525
},
2626
"devDependencies": {
2727
"google-closure-compiler": "^20230802.0.0"

frameworks/keyed/mikado-proxy/src/main.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
import Mikado from "../node_modules/mikado/src/mikado.js";
1+
import Mikado, { once } from "../node_modules/mikado/src/mikado.js";
22
import Array from "../node_modules/mikado/src/array.js";
33
import { route } from "../node_modules/mikado/src/event.js";
44
import tpl_app from "./template/app.js";
55
import tpl_item from "./template/item.js";
66
import assignData from "./data.js";
77

8-
Mikado.once(document.body, tpl_app).eventCache = true;
8+
once(document.body, tpl_app).eventCache = true;
99

1010
// This implementation is using a full reactive paradigm.
1111
// It just applies changes to the store like an Array.
1212

13-
const state = {};
1413
const store = new Array();
15-
const view = new Mikado(tpl_item, { mount: document.getElementById("tbody"), observe: store, state });
16-
const event = { stop: true };
14+
const view = new Mikado(tpl_item, { mount: document.getElementById("tbody"), observe: store });
15+
const event = { stop: true, cancel: true };
1716

1817
route("run", () => assignData(store, 1000), event);
1918
route("runlots", () => assignData(store, 10000), event);
20-
route("add", () => assignData(store, 1000, true), event);
19+
route("add", () => assignData(store, 1000, /* append */ true), event);
2120
route("update", () => {
2221
for(let i = 0, len = store.length; i < len; i += 10)
2322
store[i].label += " !!!"
@@ -30,6 +29,7 @@ route("swaprows", () => {
3029
}, event);
3130
route("remove", target => store.splice(view.index(target), 1), event);
3231
route("select", target => {
32+
const state = view.state;
3333
const current = state.selected;
3434
state.selected = view.index(target);
3535
current >= 0 && view.update(current, store[current]);

frameworks/keyed/mikado-proxy/src/template/item.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<tr key="id" cache="true" class="{{ state.selected === index ? 'danger' : '' }}" root>
1+
<tr key="data.id" cache="true" class="{{ state.selected === index ? 'danger' : '' }}" root>
22
<td class="col-md-1">{{=data.id}}</td>
33
<td class="col-md-4">
44
<a class="lbl" click="select:root">{{=data.label}}</a>

frameworks/keyed/mikado/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<head>
44
<meta charset="utf-8"/>
55
<meta name="viewport" content="width=device-width">
6+
<link rel="preload" href="/css/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2" as="font" type="font/woff2" crossorigin>
7+
<link href="/css/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" media="screen">
8+
<link href="/css/main.css" rel="stylesheet" media="screen">
9+
<script src="dist/main.js" async></script>
610
<title>Mikado-"keyed"</title>
7-
<link rel="preload" href="dist/main.js" as="script">
8-
<link href="/css/currentStyle.css" rel="stylesheet"/>
911
</head>
10-
<body>
11-
<script src="dist/main.js"></script>
12-
</body>
12+
<body></body>
1313
</html>

frameworks/keyed/mikado/package-lock.json

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

frameworks/keyed/mikado/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
},
1818
"scripts": {
1919
"compile": "npx mikado-compile --src src/template --type module -i -f && echo Compile Complete. && exit 0",
20-
"build": "npm run compile && node task/build RELEASE=custom DEBUG=false POLYFILL=false SUPPORT_CACHE=true SUPPORT_EVENTS=true SUPPORT_DOM_HELPERS=false SUPPORT_ASYNC=false SUPPORT_TRANSPORT=false SUPPORT_TEMPLATE_EXTENSION=false SUPPORT_REACTIVE=false SUPPORT_CACHE_HELPERS=false SUPPORT_KEYED=true SUPPORT_POOLS=false SUPPORT_CALLBACKS=false SUPPORT_COMPILE=false && exit 0",
20+
"build": "npm run compile && node task/build RELEASE=custom DEBUG=false POLYFILL=false SUPPORT_CACHE=true SUPPORT_EVENTS=true SUPPORT_DOM_HELPERS=false SUPPORT_ASYNC=false SUPPORT_TRANSPORT=false SUPPORT_TEMPLATE_EXTENSION=false SUPPORT_REACTIVE=false SUPPORT_CACHE_HELPERS=false SUPPORT_KEYED=true SUPPORT_POOLS=false SUPPORT_CALLBACKS=false SUPPORT_COMPILE=false SUPPORT_WEB_COMPONENTS=false && exit 0",
2121
"build-prod": "npm run build"
2222
},
2323
"dependencies": {
24-
"mikado": "^0.8.134"
24+
"mikado": "^0.8.213"
2525
},
2626
"devDependencies": {
2727
"google-closure-compiler": "^20230802.0.0"

frameworks/keyed/mikado/src/main.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
import Mikado from "../node_modules/mikado/src/mikado.js";
1+
import Mikado, { once } from "../node_modules/mikado/src/mikado.js";
22
import { route } from "../node_modules/mikado/src/event.js";
33
import tpl_app from "./template/app.js";
44
import tpl_item from "./template/item.js";
55
import buildData from "./data.js";
66

7-
Mikado.once(document.body, tpl_app).eventCache = true;
8-
9-
// This implementation is using a full declarative paradigm,
10-
// where updates are delegated by same indizes as used for the data access.
7+
once(document.body, tpl_app).eventCache = true;
118

9+
const view = new Mikado(tpl_item, { mount: document.getElementById("tbody") });
10+
const event = { stop: true, cancel: true };
1211
let data;
13-
const state = {};
14-
const view = new Mikado(tpl_item, { mount: document.getElementById("tbody"), state });
15-
const event = { stop: true };
1612

1713
route("run", () => view.render(data = buildData(1000)), event);
1814
route("runlots", () => view.render(buildData(10000)), event);
@@ -26,11 +22,13 @@ route("update", () => {
2622
route("clear", () => view.clear(), event);
2723
route("swaprows", () => {
2824
const tmp = data[1];
29-
view.replace(1, data[1] = data[998]);
30-
view.replace(998, data[998] = tmp);
25+
data[1] = data[998]
26+
data[998] = tmp;
27+
view.render(data);
3128
}, event);
3229
route("remove", target => view.remove(target), event);
3330
route("select", target => {
31+
const state = view.state;
3432
const current = state.selected;
3533
state.selected = view.index(target);
3634
current >= 0 && view.update(current, data[current]);

frameworks/keyed/mikado/src/template/item.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<tr key="id" cache="true" class="{{ state.selected === index ? 'danger' : '' }}" root>
1+
<tr key="data.id" cache="true" class="{{ state.selected === index ? 'danger' : '' }}" root>
22
<td class="col-md-1">{{ data.id }}</td>
33
<td class="col-md-4">
44
<a class="lbl" click="select:root">{{ data.label }}</a>

0 commit comments

Comments
 (0)