A fixed memory ring buffer implementation in javascript