{"id":13673267,"url":"https://github.com/cyclejs/cycle-time-travel","last_synced_at":"2025-08-22T00:31:36.691Z","repository":{"id":66270785,"uuid":"41466293","full_name":"cyclejs/cycle-time-travel","owner":"cyclejs","description":"A time traveling debugger for Cycle.js","archived":false,"fork":false,"pushed_at":"2017-03-27T05:00:58.000Z","size":415,"stargazers_count":217,"open_issues_count":17,"forks_count":10,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-30T00:55:12.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"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":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-08-27T04:50:22.000Z","updated_at":"2024-09-27T12:43:48.000Z","dependencies_parsed_at":"2023-03-22T07:48:19.656Z","dependency_job_id":null,"html_url":"https://github.com/cyclejs/cycle-time-travel","commit_stats":{"total_commits":77,"total_committers":2,"mean_commits":38.5,"dds":"0.012987012987012991","last_synced_commit":"e53d69705b4d68407739547a6639df984e3dc013"},"previous_names":["widdershin/cycle-time-travel"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclejs%2Fcycle-time-travel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclejs%2Fcycle-time-travel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclejs%2Fcycle-time-travel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclejs%2Fcycle-time-travel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyclejs","download_url":"https://codeload.github.com/cyclejs/cycle-time-travel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230542288,"owners_count":18242332,"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-08-02T10:00:32.270Z","updated_at":"2024-12-20T06:06:49.997Z","avatar_url":"https://github.com/cyclejs.png","language":"JavaScript","funding_links":[],"categories":["Framework Developer Tools","Libraries"],"sub_categories":["Debugging"],"readme":"[![npm version](https://badge.fury.io/js/cycle-time-travel.svg)](http://badge.fury.io/js/cycle-time-travel)\n[![Build Status](https://travis-ci.org/cyclejs/cycle-time-travel.svg?branch=master)](https://travis-ci.org/cyclejs/cycle-time-travel)\n[![Code Climate](https://codeclimate.com/github/cyclejs/cycle-time-travel/badges/gpa.svg)](https://codeclimate.com/github/cyclejs/cycle-time-travel)\n* * * \n\n# cycle-time-travel\n\n`cycle-time-travel` is a time travelling stream viewer for Cycle.js apps.\n\n**[Try the online example](http://cycle.js.org/cycle-time-travel/)!**\n\nWhy you should be excited:\n---\n * It makes it easy to see data flowing through your Cycle.app\n * You can pause, and even rewind time by dragging on the stream bar\n * With hot module reloading, you could even fix your mistakes from the past!\n\nA video is worth a thousand bullet points:\n\n[![http://i.imgur.com/N5OMVzp.png](http://i.imgur.com/N5OMVzp.png)](https://www.youtube.com/watch?v=7fA0pVDHGJ0)\n\nOkay, I'm in!\n===\n\nGreat. Now just `npm install cycle-time-travel` and you can begin your mastery over time itself!\n\nHow do I use it?\n===\n\nThe API is simple, and does two things. Displaying streams, and controlling time.\n\n`import makeTimeTravel from 'cycle-time-travel'`\n\n`makeTimeTravel` takes a `DOM` observable, and an array of streams to be displayed/controlled, in the form of `{stream: stream$, label: 'stream$'}`.\n\n`makeTimeTravel` returns a `DOM` observable, and an object called `timeTravel`, with each of the streams you provided as an argument to `makeTimeTravel` available, keyed under the `label`.\n\n**Huh? Show me an example**\n\nHere is the counter example from the [Cycle.js](http://cycle.js.org/basic-examples.html) docs.\n\n```js\nimport Cycle from '@cycle/core';\nimport {h, makeDOMDriver} from '@cycle/dom';\n\nfunction main({DOM}) {\n  let action$ = Cycle.Rx.Observable.merge(\n    DOM.select('.decrement').events('click').map(ev =\u003e -1),\n    DOM.select('.increment').events('click').map(ev =\u003e +1)\n  );\n  \n  let count$ = action$.startWith(0).scan((x,y) =\u003e x+y);\n  \n  return {\n    DOM: count$.map(count =\u003e\n        h('div', [\n          h('button.decrement', 'Decrement'),\n          h('button.increment', 'Increment'),\n          h('p', 'Counter: ' + count)\n        ])\n      )\n  };\n}\n\nCycle.run(main, {\n  DOM: makeDOMDriver('#app')\n});\n```\n\nAnd here it is with time travelling:\n\n```js\nimport Cycle from '@cycle/core';\nimport {h, makeDOMDriver} from '@cycle/dom';\nimport makeTimeTravel from 'cycle-time-travel';                 // NEW\n\nfunction main({DOM}) {\n  let action$ = Cycle.Rx.Observable.merge(\n    DOM.select('.decrement').events('click').map(ev =\u003e -1),\n    DOM.select('.increment').events('click').map(ev =\u003e +1)\n  );\n  \n  let count$ = action$.startWith(0).scan((x,y) =\u003e x+y);\n  \n  let {DOM: timeTravelBar$, timeTravel} = makeTimeTravel(DOM, [ // NEW\n    {stream: count$, label: 'count$'},                          // NEW\n    {stream: action$, label: 'action$'}                         // NEW\n  ]);                                                           // NEW\n  \n  return {\n    DOM: Cycle.Rx.Observable.combineLatest(                     // NEW\n      timeTravel.count$,                                        // NEW\n      timeTravelBar$,                                           // NEW\n      (count, timeTravelBar) =\u003e                                 // NEW\n        h('.app', [                                             \n          h('div', [                                            \n            h('button.decrement', 'Decrement'),\n            h('button.increment', 'Increment'),\n            h('p', 'Counter: ' + count)\n          ]),\n          \n          timeTravelBar                                         // NEW\n        ])\n    )\n  };\n}\n\nCycle.run(main, {\n  DOM: makeDOMDriver('#app')\n});\n```\n\nThere are a few things going on above:\n * We call `makeTimeTravel`, passing in `DOM`, `count$` and `action$`.\n * We get back a `timeTravelBar` DOM observable, and a `timeTravel` object with `count$` and `action$`.\n * We then swap out the `count$` that was being used to power the view with `timeTravel.count$`\n * We also have to `combineLatest` and add the `timeTravelBar` to the `DOM` that we return\n\nThat seems like a lot of work...\n===\n\nIt might, but try it anyway! `cycle-time-travel` is in alpha so the API is still under development. If you have any feedback on how it could be easier to use, I'd love to hear it.\n\nFor more examples, see the `/examples` folder.\n\nLicense\n===\n\n`cycle-time-travel` is available under the MIT license. See the `LICENSE` file for full text.\n\n\nContributing\n====\n\nI encourage and welcome contributions, be it pull requests, issues or just feedback. If in doubt, get in touch with me at [ncwjohnstone@gmail.com](mailto:ncwjohnstone@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyclejs%2Fcycle-time-travel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyclejs%2Fcycle-time-travel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyclejs%2Fcycle-time-travel/lists"}