AMD/requirejs support, encapsulate function and expose to window/requirejs/node

https://github.com/23/resumable.js/pull/123 without indentation