{"id":18541290,"url":"https://github.com/cyclejs/jsonp","last_synced_at":"2025-07-01T23:06:39.941Z","repository":{"id":2061844,"uuid":"39256342","full_name":"cyclejs/jsonp","owner":"cyclejs","description":"Driver for HTTP requests through JSONP","archived":false,"fork":false,"pushed_at":"2022-06-22T08:17:15.000Z","size":264,"stargazers_count":7,"open_issues_count":5,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-08T18:14:02.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyclejs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-17T13:49:35.000Z","updated_at":"2022-06-24T06:31:41.000Z","dependencies_parsed_at":"2022-09-20T17:45:42.070Z","dependency_job_id":null,"html_url":"https://github.com/cyclejs/jsonp","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/cyclejs/jsonp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclejs%2Fjsonp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclejs%2Fjsonp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclejs%2Fjsonp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclejs%2Fjsonp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyclejs","download_url":"https://codeload.github.com/cyclejs/jsonp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclejs%2Fjsonp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259920598,"owners_count":22932177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T20:04:38.037Z","updated_at":"2025-07-01T23:06:39.894Z","avatar_url":"https://github.com/cyclejs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cycle JSONP\n\nA Driver for making HTTP requests through the JSONP hack, based on the [jsonp](https://github.com/webmodules/jsonp) package. This package is small, hacky (as JSONP is too), and untested. Whenever possible, use proper server and client CORS solution with the HTTP Driver.\n\n```\nnpm install @cycle/jsonp\n```\n\n## Usage\n\n```js\nfunction main(responses) {\n  // This API endpoint returns a JSON response\n  const HELLO_URL = 'http://localhost:8080/hello';\n  let request$ = Rx.Observable.just(HELLO_URL);\n  let vtree$ = responses.JSONP\n    .filter(res$ =\u003e res$.request === HELLO_URL)\n    .mergeAll()\n    .startWith({text: 'Loading...'})\n    .map(json =\u003e\n      h('div.container', [\n        h('h1', json.text)\n      ])\n    );\n\n  return {\n    DOM: vtree$,\n    JSONP: request$\n  };\n}\n\nCycle.run(main, {\n  DOM: makeDOMDriver('.js-container'),\n  JSONP: makeJSONPDriver()\n})\n```\n\n# API\n\n## \u003ca id=\"makeJSONPDriver\"\u003e\u003c/a\u003e `makeJSONPDriver()`\n\nJSONP Driver factory.\n\nThis is a function which, when called, returns a JSONP Driver for Cycle.js\napps. The driver is also a function, and it takes a stream of requests\n(URL strings) as input, and generates a metastream of responses.\n\n**Requests**. The stream of requests should emit strings as the URL of the\nremote resource over HTTP.\n\n**Responses**. A metastream is a stream of streams. The response metastream\nemits streams of responses. These streams of responses have a `request`\nfield attached to them (to the stream object itself) indicating which\nrequest (from the driver input) generated this response stream. The\nresponse streams themselves emit the response object received through the\nnpm `jsonp` package.\n\n#### Returns:\n\n*(Function)* the JSONP Driver function\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyclejs%2Fjsonp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyclejs%2Fjsonp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyclejs%2Fjsonp/lists"}