{"id":48313,"library":"jsonp-retry","title":"jsonp-retry","description":"A JSONP library with built-in retry and localStorage caching. Version 1.0.3 (latest). Provides configurable retries on timeout, backup URLs, and optional automatic storage/retrieval of responses from localStorage with a custom validation function. Designed for browser environments where JSONP is needed (e.g., cross-domain requests). Simple API supporting callback and Promise patterns. Not actively maintained (no recent commits). Minimal dependencies.","status":"maintenance","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/luckyadam/jsonp-retry","tags":["javascript","jsonp"],"install":[{"cmd":"npm install jsonp-retry","lang":"bash","label":"npm"},{"cmd":"yarn add jsonp-retry","lang":"bash","label":"yarn"},{"cmd":"pnpm add jsonp-retry","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package exports a default function; CommonJS require works too.","wrong":"const jsonp = require('jsonp-retry')","symbol":"default","correct":"import jsonp from 'jsonp-retry'"},{"note":"There is no named export 'jsonp'; use default import.","wrong":"import { jsonp } from 'jsonp-retry'","symbol":"jsonp","correct":"const jsonp = require('jsonp-retry')"},{"note":"The function accepts an optional callback; if omitted, returns a Promise (if Promise is available).","wrong":"jsonp(url, opts).then(data => {}).catch(err => {}) (Promise usage is fine but note that the callback-style is default; cannot use both at same time)","symbol":"default","correct":"jsonp(url, opts, (err, data) => {})"}],"quickstart":{"code":"import jsonp from 'jsonp-retry';\n\nconst url = '//api.example.com/data';\nconst opts = {\n  timeout: 3000,\n  retryTimes: 1,\n  useStore: true,\n  storeCheckKey: 'version',\n  dataCheck: (data) => data && data.status === 'ok'\n};\n\njsonp(url, opts, (err, data) => {\n  if (err) {\n    console.error('JSONP error:', err);\n    return;\n  }\n  console.log('Data:', data);\n});","lang":"javascript","description":"Basic usage with callback, timeout, retry, and localStorage caching with data validation."},"warnings":[{"fix":"Provide both `useStore: true` and `storeCheckKey` (a field name in your data that can serve as a cache validity check).","message":"The `useStore` option defaults to false; if you enable it without setting `storeCheckKey`, it may not work as expected.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"If you want to cache data across page loads, use `useStore` instead of `cache`.","message":"The `cache` option does NOT cache the response in memory or localStorage; it controls whether the browser caches the JSONP script request (adding a timestamp to prevent caching). Setting `cache: true` may cause stale data.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Only use JSONP with trusted endpoints. Consider CORS or other methods instead.","message":"JSONP is inherently insecure due to script injection risks; ensure you trust the source URL.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Implement additional error handling using the callback error argument.","message":"The library does not handle cross-origin errors beyond timeout; network failures may not be caught properly.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'1.0.3':16 'activ':59 'api':52 'automat':27 'backup':23 'browser':40 'built':9 'built-in':8 'cach':14 'callback':54 'commit':63 'configur':19 'cross':48 'cross-domain':47 'custom':35 'depend':65 'design':38 'domain':49 'e.g':46 'environ':41 'function':37 'javascript':66 'jsonp':2,5,43,67 'jsonp-retri':1 'latest':17 'librari':6 'localstorag':13,32 'maintain':60 'minim':64 'need':45 'option':26 'pattern':57 'promis':56 'provid':18 'recent':62 'request':50 'respons':30 'retri':3,11,20 'simpl':51 'storage/retrieval':28 'support':53 'timeout':22 'url':24 'valid':36 'version':15","created_at":"2026-06-07T16:56:00.246836+00:00","updated_at":"2026-06-07T16:56:00.246836+00:00","problems":[{"fix":"Install: npm install jsonp-retry. Import: const jsonp = require('jsonp-retry');","cause":"Using CommonJS require but with wrong variable name or not installing the package.","error":"Uncaught ReferenceError: jsonp is not defined"},{"fix":"Use: import jsonp from 'jsonp-retry'; or const jsonp = require('jsonp-retry');","cause":"Trying to use named import { jsonp } instead of default import.","error":"TypeError: jsonp is not a function"},{"fix":"Increase the timeout value or ensure the server responds in time.","cause":"The JSONP request did not complete within `timeout` ms, and retries may be attempted.","error":"Timeout error: Request timed out"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/luckyadam/jsonp-retry#readme","github":"https://github.com/luckyadam/jsonp-retry","docs":null,"changelog":null,"pypi":null,"npm":"jsonp-retry","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}