smol-jsonp

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

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
smol-jsonp
331.1.02 years ago5 years agoMinified + gzip package size for smol-jsonp in KB

Readme

smol-jsonp
small, promise-based, zero-dependency jsonp library for browsers. ~330b gzip
Install - Usage - License: Apache-2.0
!npmnpm-imagenpm-url !standardstandard-imagestandard-url

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