{"id":16124302,"url":"https://github.com/jongacnik/streamjax","last_synced_at":"2025-09-06T00:48:21.795Z","repository":{"id":68335762,"uuid":"81064125","full_name":"jongacnik/streamjax","owner":"jongacnik","description":"🚿 streaming pjax???","archived":false,"fork":false,"pushed_at":"2017-02-13T08:15:31.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T12:27:07.235Z","etag":null,"topics":["pjax","stream"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jongacnik.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-06T08:19:59.000Z","updated_at":"2019-05-22T21:36:08.000Z","dependencies_parsed_at":"2023-04-28T09:04:57.712Z","dependency_job_id":null,"html_url":"https://github.com/jongacnik/streamjax","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jongacnik/streamjax","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fstreamjax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fstreamjax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fstreamjax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fstreamjax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jongacnik","download_url":"https://codeload.github.com/jongacnik/streamjax/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fstreamjax/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273842869,"owners_count":25177921,"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","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["pjax","stream"],"created_at":"2024-10-09T21:20:30.609Z","updated_at":"2025-09-06T00:48:21.756Z","avatar_url":"https://github.com/jongacnik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# streamjax\n\n*Very* experimental pjax implementation which streams content into container using an [`iframe` and `document.write`](https://jakearchibald.com/2016/fun-hacks-faster-content/)\n\n**Warning: not actually on the npm registry ☢️**\n\n## Example\n\n```js\nvar streamjax = require('streamjax')\nvar sjax = streamjax({\n  container: 'main'\n})\n\nsjax.on('unload', function () {\n  console.log('before stream')\n})\n\nsjax.on('load', function (e) {\n  console.log('after content fully streamed', e.url, e.location)\n})\n```\n\nNow on any anchor click, `streamjax` will perform an XHR request and attempt to stream the contents of the request into the container element.\n\n## Heads up\n\nSince the content is *streamed* into the container, there is no way to parse the HTML being XHR'd. This means you must send an html partial with **only** the content which should end up in the container (and you can only update a single container). This differs from traditional pjax implementations where you can send an entire HTML page through the pipes and update multiple containers.\n\nYou can pull this off on the server end of things by checking for a `XMLHttpRequest` header and sending a partial. Doable in a static site scenario too with some pre-planning.\n\n## FAQ\n\n### What?\n\n[Pjax](https://github.com/MoOx/pjax) is a super handy way to appify a static site, but the need to complete the entire XHR request before setting `innerHTML` of the container can actually slow things down vs standard page refreshes. Streaming the content as the req is happening lets things get on screen faster.\n\n### Says who?\n\nSome ideas are being thrown around over on the HTML Standard Github about [a way to stream content into an element](https://github.com/whatwg/html/issues/2142). In that thread Jake Archibald links to a write up about performance gains streaming content into an element by [hijacking `iframe` and `doc.write`](https://jakearchibald.com/2016/fun-hacks-faster-content/) vs traditional pjax-style implementations. All credit to Jake on the hard work – thanks! ✨\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongacnik%2Fstreamjax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjongacnik%2Fstreamjax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongacnik%2Fstreamjax/lists"}