Fix up javascript, don't trigger api with every acceleration event