
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Jsonp in Promise and callback mode.
npm install jsonp_p
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'}
}
});
type url = string;
request url
type params = object;
query string defaultencodeURI
type callback = string;
callback name
type timeout = number;
type onSuccess = (res: object) => any;
If callback mode is preferred, then a function can be passed to onSuccess
type onError = (err: Error) => any;
Just like onSuccess, available if callback mode is preferred
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.
FAQs
Promise based jsonp
We found that jsonp_p demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.