smol-jsonp
v1.1.0
Published
small, promise-based, zero-dependency jsonp library for browsers. ~330b gzip
Downloads
136
Maintainers
Readme
smol-jsonp
small, promise-based, zero-dependency jsonp library for browsers. ~330b gzip
Install - Usage - License: Apache-2.0
Install
npm install smol-jsonp
Usage
var jsonp = require('smol-jsonp')
async function main () {
// does <script src="http://some-jsonp-url?query=etc&callback={NAME}"></script>
var result = await jsonp('http://some-jsonp-url?query=etc')
// does <script src="http://some-jsonp-url?cb={NAME}"></script>
var result2 = await jsonp('http://some-jsonp-url', { param: 'cb' })
}
This package uses a global variable window.__jsonpCallbacks
to register callbacks. Do not touch it.