diff --git a/In Javascript/airgap.js b/In Javascript/airgap.js index 908d93d..a0aef3a 100644 --- a/In Javascript/airgap.js +++ b/In Javascript/airgap.js @@ -3,27 +3,26 @@ //Tested to be working on Chrome at 1560khz function now() { - return performance.now()*1000000; + return window.performance.now() * 1000000; } var NSEC_PER_SEC = 1000000000; var register = 3.1415; -function square_am_signal(time,freq) { - document.getElementById('logs').value += "Playing / "+time+" seconds / "+freq+"Hz\n"; - var period = NSEC_PER_SEC/freq; +function square_am_signal(time, freq) { + document.getElementById('logs').value += "Playing / " + time + " seconds / " + freq + "Hz\n"; + var period = NSEC_PER_SEC / freq; var start = now(); - var end = now()+time*NSEC_PER_SEC; + var end = now() + time * NSEC_PER_SEC; while (now() < end) { - var mid = start+period/2; - var reset = start+period; - while (now()