Skip to content

small, promise-based, zero-dependency jsonp library for browsers. ~330b gzip

License

Notifications You must be signed in to change notification settings

goto-bus-stop/smol-jsonp

Repository files navigation

smol-jsonp

small, promise-based, zero-dependency jsonp library for browsers. ~330b gzip

Install - Usage - License: Apache-2.0

npm standard

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.

License

Apache-2.0

About

small, promise-based, zero-dependency jsonp library for browsers. ~330b gzip

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •