Tyler Graf
Tyler Graf

Reputation: 454

Using superagentjs from window (without require)

I need to make an asynchronous call from the browser.

I'd like to use superagentjs, but my current project won't support require().

Is there a way to use superagent from the window object?

Upvotes: 1

Views: 1238

Answers (2)

Brandon Silva
Brandon Silva

Reputation: 446

Nowadays you can generate a superagent.js (usable without Require.js) by running:

npm install
make superagent.js

within the superagent module folder.

Upvotes: 3

James Black
James Black

Reputation: 102

This is accomplished simply by including the superagent.js file on the page as any other javascript, if require is not defined this will simply end up hooking it onto the window at window.superagent.

https://github.com/visionmedia/superagent#browser-build explains that ./superagent.js is the standalone.

Upvotes: 4

Related Questions