made simplex.js suitable for either Node.js or the browser