webmodules / jsonp

A simple JSONP implementation
1.91k stars 332 forks source link

return promise #51

Open LubanSeven opened 5 years ago

LubanSeven commented 5 years ago

hello, can jsonp function return new promise ?

DigitalBrainJS commented 5 years ago

Seems it can't, but you can write your own wrapped function like following: const jsonpFetch = (url, options) => new Promise((resolve, reject) => jsonp(url, options, (err, data) => err ? reject(err) : resolve(data))); ...or just use some another jsonp package.