{"id":15636672,"url":"https://github.com/feliciousx/cycle-history-docs","last_synced_at":"2025-07-17T20:33:52.311Z","repository":{"id":148953623,"uuid":"89127252","full_name":"FeliciousX/cycle-history-docs","owner":"FeliciousX","description":"Extra docs for @cycle/history","archived":false,"fork":false,"pushed_at":"2017-04-23T10:30:08.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-29T20:23:07.656Z","etag":null,"topics":["cyclejs","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/FeliciousX.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-04-23T08:18:57.000Z","updated_at":"2017-04-24T09:51:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"631db03f-b7cf-42f1-a57c-67786b9e2b72","html_url":"https://github.com/FeliciousX/cycle-history-docs","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"ee014e0d1568d4221245c53a18dbe16f285ebcd5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FeliciousX/cycle-history-docs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FeliciousX%2Fcycle-history-docs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FeliciousX%2Fcycle-history-docs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FeliciousX%2Fcycle-history-docs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FeliciousX%2Fcycle-history-docs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FeliciousX","download_url":"https://codeload.github.com/FeliciousX/cycle-history-docs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FeliciousX%2Fcycle-history-docs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265659176,"owners_count":23806880,"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":["cyclejs","stream"],"created_at":"2024-10-03T11:05:57.975Z","updated_at":"2025-07-17T20:33:52.262Z","avatar_url":"https://github.com/FeliciousX.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"This repo contains usage examples for [`@cycle/history`](https://cycle.js.org/api/history.html) driver\n\n`@cycle/history` is a wrapper around [history.js](https://github.com/reacttraining/history).\n\nWhat can `@cycle/history` do?\n\nGives you history source which is a stream of [Location object](https://github.com/reacttraining/history#usage)\n\nIt looks like...\n\n```javascript\n{\n  pathname: '/',\n  search: '',\n  hash: '',\n  state: undefined,\n  key: 'ab41sc'\n}\n```\n\nIt accepts a stream of strings ( url ) or a stream of Objects that looks like...\n\n```javascript\n{\n  type: 'push',\n  pathname: '/home',\n  state: { foo: 'bar' }\n}\n```\n\n### How do I use it?\n\n```javascript\nimport xs from 'xstream';\nimport { run } from '@cycle/run';\nimport { makeHistoryDriver } from '@cycle/history';\n\nconst drivers = {\n  history: makeHistoryDriver(),\n  debug: x$ =\u003e x$.subscribe({ next: console.log })\n};\n\nfunction main(sources) {\n  const history$ = xs.periodic(5000).take(5).map(i =\u003e `some_url_${i}`);\n\n  const sinks = {\n    history: history$,\n    debug: sources.history\n  };\n  return sinks;\n}\n\nrun(main, drivers);\n```\n\nThis is enough to see the URL changes on the browser.\n\n\n### What action type does it support?\n\nIt [supports](https://github.com/cyclejs/cyclejs/blob/cda6a8e525b8062c6765027db4683afb21242e8a/history/src/createHistory%24.ts#L17-L35) 5 different types of actions.\n\npush...\n\n```javascript\n{\n  type: 'push',\n  pathname: 'path',\n  state: 'anything'\n}\n```\n\nreplace...\n\n```javascript\n{\n  type: 'replace',\n  pathname: 'path',\n  state: 'anything'\n}\n```\n\ngo...\n\n```javascript\n{\n  type: 'go',\n  amount: 1\n}\n```\n\ngoBack...\n\n```javascript\n{\n  type: 'goBack'\n}\n```\n\ngoForward...\n\n```javascript\n{\n  type: 'goForward'\n}\n```\n\n### Example of routing an app?\n\n```javascript\n//\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeliciousx%2Fcycle-history-docs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeliciousx%2Fcycle-history-docs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeliciousx%2Fcycle-history-docs/lists"}