Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsonp_p

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonp_p

Promise based jsonp

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

Build Status

jsonp_p

Jsonp in Promise and callback mode.

Installing

npm install jsonp_p

Usage

import jsonp from "jsonp_p";

// Promise mode
jsonp({
  url: "http://jsfiddle.net/echo/jsonp/",
  params: {
    name: "jsonp_p",
    version: "0.0.1"
  },
  callback: "jsonp"
}).then(data => {
  console.log(data);
  //{name: 'jsonp_p',version: '0.0.1'}
});

// callback mode
jsonp({
  url: "http://jsfiddle.net/echo/jsonp/",
  params: {
    name: "jsonp_p",
    version: "0.0.1"
  },
  callback: "jsonp",
  onSuccess(data) {
    console.log(data);
    //{name: 'jsonp_p',version: '0.0.1'}
  }
});

options

url

type url = string;

request url

[params]

type params = object;

query string defaultencodeURI

[callback]

type callback = string;

callback name

[timeout]

type timeout = number;

[onSuccess]

type onSuccess = (res: object) => any;

If callback mode is preferred, then a function can be passed to onSuccess

[onError]

type onError = (err: Error) => any;

Just like onSuccess, available if callback mode is preferred

Callback and Promise

jsonp_p supports callback mode now.

If a global Promise is available, jsonp_p can also run in Promise mode.

If your environment doesn't support Promise, you can add polyfill.

Keywords

FAQs

Package last updated on 18 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc