diff --git a/examples/dbmonster/mithril-bundle/app.js b/examples/dbmonster/mithril-bundle/app.js new file mode 100644 index 00000000..9f5d0cc9 --- /dev/null +++ b/examples/dbmonster/mithril-bundle/app.js @@ -0,0 +1,49 @@ +"use strict" + +var m = require("../../../mithril") + +perfMonitor.startFPSMonitor() +perfMonitor.startMemMonitor() +perfMonitor.initProfiler("render") + +var data = [] + +m.mount(document.getElementById("app"), { + view: function() { + return m("div", [ + m("table", {className: "table table-striped latest-data"}, [ + m("tbody", + data.map(function(db) { + return m("tr", {key: db.dbname}, [ + m("td", {className: "dbname"}, db.dbname), + m("td", {className: "query-count"}, [ + m("span", {className: db.lastSample.countClassName}, db.lastSample.nbQueries) + ]), + db.lastSample.topFiveQueries.map(function(query) { + return m("td", {className: query.elapsedClassName}, [ + query.formatElapsed, + m("div", {className: "popover left"}, [ + m("div", {className: "popover-content"}, query.query), + m("div", {className: "arrow"}) + ]) + ]) + }) + ]) + }) + ) + ]) + ]) + } +}) + +function update() { + data = ENV.generateData().toArray() + + perfMonitor.startProfile("render") + m.redraw() + perfMonitor.endProfile("render") + + setTimeout(update, ENV.timeout) +} + +update() diff --git a/examples/dbmonster/mithril-bundle/index.html b/examples/dbmonster/mithril-bundle/index.html new file mode 100644 index 00000000..b8b4df98 --- /dev/null +++ b/examples/dbmonster/mithril-bundle/index.html @@ -0,0 +1,17 @@ + + +
+ + + +