Update jsonapi-v2.js

Check for 'window' while require some tools.
So we can use require in browser with dropin_require or requirejs.