Javascript metronom using browser clock