1. jsonp
A sane JSONP implementation.
jsonp
Package: jsonp
Created by: LearnBoost
Last modified: Sun, 04 Sep 2022 08:07:42 GMT
Version: 0.2.1
Downloads: 2,343,770
Repository: https://github.com/LearnBoost/jsonp

Install

npm install jsonp
yarn add jsonp

jsonp

A simple JSONP implementation.

saucelabs

Installation

Install for node.js or browserify using npm:

 $ npm install jsonp

Install for component(1) using component:

 $ component install LearnBoost/jsonp

Install for browser using bower:

 $ bower install jsonp

API

jsonp(url, opts, fn)

  • url (String) url to fetch
  • opts (Object), optional
    • param (String) name of the query string parameter to specify
      the callback (defaults to callback)
    • timeout (Number) how long after a timeout error is emitted. 0 to
      disable (defaults to 60000)
    • prefix (String) prefix for the global callback functions that
      handle jsonp responses (defaults to __jp)
    • name (String) name of the global callback functions that
      handle jsonp responses (defaults to prefix + incremented counter)
  • fn callback

The callback is called with err, data parameters.

If it times out, the err will be an Error object whose message is
Timeout.

Returns a function that, when called, will cancel the in-progress jsonp request
(fn won't be called).

License

MIT

Dependencies

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin