Skip to content

Commit

Permalink
feat: throttle from search string
Browse files Browse the repository at this point in the history
  • Loading branch information
csimi committed Feb 5, 2022
1 parent 453e4d1 commit bc632f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 10 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@
<body>
<div id="clock"></div>
<script>
const throttle = 8;
const parseIntDefault = (str, def) => {
const num = parseInt(str, 10);
if (isFinite(num)) {
return num;
}

return def;
};

const throttle = Math.max(0, parseIntDefault(window.location.search.slice(1), 0));
const div = document.getElementById('clock');
const text = document.createTextNode('');
div.appendChild(text);
Expand Down
9 changes: 8 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Microsecond resolution clock

https://csimi.github.io/microclock
https://csimi.github.io/microclock/

## Features

- throttle using search string (for example `?8`)
- scales to viewport
- no GDPR consent popup
- no header or anything that can get in the way

0 comments on commit bc632f7

Please sign in to comment.