1
0
mirror of https://github.com/morris/vanilla-todo.git synced 2025-08-22 13:43:06 +02:00

styling, improve fps

This commit is contained in:
Morris Brodersen
2020-10-21 14:04:40 +02:00
parent 4dc6ac879d
commit 00f5323541
8 changed files with 17 additions and 8 deletions

View File

@@ -2,6 +2,7 @@
window.VT = window.VT || {};
VT.AppFps = function (el) {
var sampleSize = 20;
var times = [];
tick();
@@ -11,20 +12,20 @@ VT.AppFps = function (el) {
times.push(performance.now());
if (times.length < 60) return;
if (times.length <= sampleSize) return;
var min = Infinity;
var max = 0;
var sum = 0;
for (var i = 1; i < 60; ++i) {
for (var i = 1; i < sampleSize + 1; ++i) {
var delta = times[i] - times[i - 1];
min = Math.min(min, delta);
max = Math.max(max, delta);
sum += delta;
}
var fps = (60 / sum) * 1000;
var fps = (sampleSize / sum) * 1000;
el.innerText =
fps.toFixed(0) +

View File

@@ -27,7 +27,7 @@ VT.TodoApp = function (el) {
' <p>',
' VANILLA TODO &copy 2020 <a href="https://morrisbrodersen.de">Morris Brodersen</a>',
' &mdash; A case study on viable techniques for vanilla web development.',
' <a href="https://github.com/morris/vanilla-todo">About</a>',
' <a href="https://github.com/morris/vanilla-todo">About</a>',
' </p>',
'</footer>',
].join('\n');

View File

@@ -119,7 +119,7 @@ VT.TodoFrameCustom = function (el) {
}
function updateHeight() {
var height = 400;
var height = 280;
var container = el.querySelector('.container');
var i, l;

View File

@@ -96,7 +96,7 @@ VT.TodoFrameDays = function (el) {
}
function updateHeight() {
var height = 400;
var height = 280;
var container = el.querySelector('.container');
for (var i = 0, l = container.children.length; i < l; ++i) {