jsonp
jsonp utils for loading data with jsonp. It has two APIs, you can give a callback or expect a vow promise in return.
Installation:
npm install jsonp-utils
In the browser:
Usage:
After you've initialized jsonp you can do as many requests you want as quickly as you want, jsonp will ensure that the right callback will get the right data and do all the clean up for you!
var Jsonp = ; // create a new jsonp request brokervar jsonp = // requires the name of param to set to specify the callback name callbackName: "jsoncallback" // defaults to 15000 timeout: 30000 // the url to hit url: "http://www.flickr.com/services/rest/"; var request = method: "flickr.test.echo" format: "json" api_key: "a1faa53df9402fc5cc2d9746118f9ddc"; // Using the callback APIjsonp; // Using the promise API (vow promise)var promise = jsonp; promise;
Licence
MIT