Skip to content

Commit

Permalink
updating hyperapp to 0.15.1 and added to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
okwolf committed Oct 14, 2017
1 parent beeea09 commit 2616c8d
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 32 deletions.
3 changes: 1 addition & 2 deletions hyperapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
</head>
<body>
<div id="app"></div>
<script src="../lib/hyperapp/app.min.js"></script>
<script src="../lib/hyperapp/h.min.js"></script>
<script src="../lib/hyperapp.min.js"></script>
<script src="../ENV.js"></script>
<script src="../lib/memory-stats.js"></script>
<script src="../lib/monitor.js"></script>
Expand Down
82 changes: 54 additions & 28 deletions hyperapp/index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,55 @@
app({
root: document.getElementById("app"),
model: [],
view: model =>
h("div", {}, [
h("table", { class: "table table-striped latest-data" }, [
h("tbody", {}, model.map(db => h("tr", { key: db.dbname }, [
h("td", { class: "dbname" }, [db.dbname]),
h("td", { class: "query-count" }, [
h("span", { class: db.lastSample.countClassName }, [db.lastSample.nbQueries])
]),
db.lastSample.topFiveQueries.map(query =>
h("td", { class: query.elapsedClassName }, [
query.formatElapsed,
h("div", { class: "popover left" }, [
h("div", { class: "popover-content" }, [query.query]),
h("div", { class: "arrow" })
])
]))
])))
])
]),
update: {
generate: _ => ENV.generateData().toArray(Monitoring.renderRate.ping())
'div,span,table,tbody,tr,td'.split(',').map(function(tag) {
window[tag] = hyperapp.h.bind(null, tag);
});

hyperapp.app(
{
state: { rows: [] },
view: state =>
div(
{},
table(
{ class: 'table table-striped latest-data' },
tbody(
{},
state.rows.map(row =>
tr(
{ key: row.dbname },
td({ class: 'dbname' }, [row.dbname]),
td(
{ class: 'query-count' },
span(
{ class: row.lastSample.countClassName },
row.lastSample.nbQueries
)
),
row.lastSample.topFiveQueries.map(query =>
td(
{ class: query.elapsedClassName },
query.formatElapsed,
div(
{ class: 'popover left' },
div(
{ class: 'popover-content' },
query.query,
div({ class: 'arrow' })
)
)
)
)
)
)
)
)
),
actions: {
generate: () => ({
rows: ENV.generateData().toArray(Monitoring.renderRate.ping())
})
},
subs: [
(_, msg) => setInterval(msg.generate, ENV.timeout)
]
})
init(state, actions) {
setInterval(actions.generate, ENV.timeout);
}
},
document.getElementById('app')
);
1 change: 1 addition & 0 deletions lib/hyperapp.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion lib/hyperapp/app.min.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/hyperapp/h.min.js

This file was deleted.

1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ You can test it at https://mathieuancelin.github.io/js-repaint-perfs/
* [Elem](https://github.com/mathieuancelin/Elem)
* [elem-vdom](https://github.com/mathieuancelin/elem-vdom)
* [Ember](http://emberjs.com/)
* [Hyperapp](https://hyperapp.js.org)
* [Mithril](http://mithril.js.org/)
* [MagJS](https://github.com/magnumjs/mag.js)
* [Ractive](http://www.ractivejs.org/)
Expand Down

0 comments on commit 2616c8d

Please sign in to comment.