Great software speaks for itself.

Introducing buffer.js

originally written July 18, 2012

This is just a quick post to mention a new javascript example I put together. Buffer.js is designed to be an explicit circular buffer implementation to help with streaming data (such as push notifications or other actionable/renderable socket content) in browser. One handy application might be game data that is pushed down to the client but isn’t quite ready to be parsed just yet.

Just 2k after compression! Check it out on Github.

All joking aside, this whole thing can basically be accomplished by two built-in JS methods, ‘shift’ and ‘push’. It’d take a few more lines to apply a buffer size limit and type enforcement, so the whole excersize was one of expressed concept rather than utility. (I had to prove I understood the ‘head’ and ‘tail’ concepts.)

Anyway, I plan on going back to make use of the shift and push methods now that the assignment is complete.