use Universal Module Definition to support AMD and CommonJS

Changed the module wrapped to use UMD. This supports AMD, CommonJS and exporting to root (ie vanilla script tag).