Skip to content

Commit c5886e5

Browse files
feat: Revert "feat: sine wave!"
BREAKING CHANGE: the applause button now sends clap counts again rather than an offset
1 parent 25fb09d commit c5886e5

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/applause-button.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,14 @@ const getClaps = url =>
1010
}
1111
}).then(response => response.text());
1212

13-
14-
const WAVELENGTH = 60 * 5;
15-
const secondsForClap = a => (WAVELENGTH * Math.asin(a / 10)) / (Math.PI * 2);
16-
17-
const computeRequest = clapCount => {
18-
const requiredSeconds = secondsForClap(clapCount);
19-
const serverSeconds = (Date.now() / 1000) % 60;
20-
const delta = requiredSeconds - serverSeconds;
21-
return delta;
22-
}
23-
2413
const updateClaps = (claps, url) =>
2514
// TODO: polyfill for IE (not edge)
2615
fetch(`${API}/update-claps` + (url ? `?url=${url}` : ""), {
2716
method: "POST",
2817
headers: {
2918
"Content-Type": "text/plain"
3019
},
31-
body: JSON.stringify(computeRequest(claps))
20+
body: JSON.stringify(claps)
3221
}).then(response => response.text());
3322

3423
const arrayOfSize = size => new Array(size).fill(undefined);

0 commit comments

Comments
 (0)