xxx (currently published as jmao)
This dangerous module converts any arbitrary JS into an ArrayBuffer, and converts any such ArrayBuffer back to JS. That's in the browser. In Node, it transparently uses Buffers.
It includes special handling for browserify's Node Buffer, and for ndarrays.
why johnny?
A couple of reasons.
Browsers speak ArrayBuffers at the lowest level. I wanted to to send and recieve data that way. I use ndarrays and TypedArrays a lot, so I wanted to easily send them over the network, and between windows / processes. Stringifying large ArrayBuffers is not ideal. But sending metadata such as can accompany any old JSON is nice. The twain have met. Now I can shoot straight JS data types from one tab to another, and over the network.
So you can
This module exports two functions:
var xxx = var deconstruct = xxxdeconstructvar construct = xxxconstruct
continuing...
var obj = id: 'HK289hns918hNPN8yphp' body: 64var event = name: 'data' data: objvar buffer = // ArrayBuffer {}windowparent
elsewhere...
window{ var buffer = evtdata var event = var data = eventdata}