{"id":26975151,"url":"https://github.com/izure1/undoit","last_synced_at":"2026-01-25T14:05:33.823Z","repository":{"id":154409987,"uuid":"632104800","full_name":"izure1/undoit","owner":"izure1","description":"Simple undo, redo system for JavaScript/TypeScript.","archived":false,"fork":false,"pushed_at":"2024-11-13T21:18:13.000Z","size":69,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-15T11:55:59.607Z","etag":null,"topics":["undo","undo-redo"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/izure1.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-24T18:08:14.000Z","updated_at":"2024-11-13T21:18:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"147dad2e-113e-433b-8e6d-53fb664e0ecc","html_url":"https://github.com/izure1/undoit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/izure1/undoit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izure1%2Fundoit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izure1%2Fundoit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izure1%2Fundoit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izure1%2Fundoit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/izure1","download_url":"https://codeload.github.com/izure1/undoit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izure1%2Fundoit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28754146,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T13:59:49.818Z","status":"ssl_error","status_checked_at":"2026-01-25T13:59:33.728Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["undo","undo-redo"],"created_at":"2025-04-03T11:19:14.219Z","updated_at":"2026-01-25T14:05:33.792Z","avatar_url":"https://github.com/izure1.png","language":"TypeScript","readme":"# Undoit\r\n\r\n[![](https://data.jsdelivr.com/v1/package/npm/undoit/badge)](https://www.jsdelivr.com/package/npm/undoit)\r\n![Node.js Workflow](https://github.com/izure1/undoit/actions/workflows/node.js.yml/badge.svg)\r\n\r\nSimple undo, redo system for JavaScript/TypeScript.\r\n\r\n## How to use\r\n\r\n```typescript\r\nimport { Action, UndoRedo } from 'undoit'\r\n\r\nconst command = new UndoRedo()\r\nlet acc = 0\r\n\r\nconst execute = () =\u003e {\r\n  acc++\r\n}\r\nconst undo = () =\u003e {\r\n  acc--\r\n}\r\n\r\ncommand.execute(new Action(execute, undo))\r\nacc // 1\r\ncommand.undo()\r\nacc // 0\r\ncommand.redo()\r\nacc // 1\r\n```\r\n\r\n### Work asynchronously\r\n\r\n```typescript\r\nimport { AsyncAction, AsyncUndoRedo } from 'undoit'\r\n\r\nconst command = new AsyncUndoRedo()\r\nlet acc = 0\r\n\r\nfunction delay(interval) {\r\n  return new Promise((resolve) =\u003e {\r\n    setTimeout(resolve, interval)\r\n  })\r\n}\r\n\r\nconst execute = async () =\u003e {\r\n  await delay(100)\r\n  acc++\r\n}\r\nconst undo = async () =\u003e {\r\n  await delay(100)\r\n  acc--\r\n}\r\n\r\nawait command.execute(new AsyncAction(execute, undo))\r\nacc // 1\r\nawait command.undo()\r\nacc // 0\r\nawait command.redo()\r\nacc // 1\r\n\r\n// without a await keyword\r\ncommand.undo()\r\ncommand.isBusy // true\r\n```\r\n\r\n### Manage easily with state history\r\n\r\n```typescript\r\nimport { StateHistory } from 'undoit'\r\n\r\nconst initialValue = 1\r\nconst history = new StateHistory(1)\r\n\r\nhistory.data // 1\r\n\r\nhistory.push(2)\r\nhistory.data // 2\r\n\r\nhistory.undo()\r\nhistory.data // 1\r\n\r\nhistory.redo()\r\nhistory.data // 2\r\n```\r\n\r\n## Install\r\n\r\n|Site|Link|\r\n|---|---|\r\n|**NPM**|[View](https://www.npmjs.com/package/undoit)|\r\n|**Github**|[View](https://github.com/izure1/undoit)|\r\n|**jsdelivr**|[Download](https://cdn.jsdelivr.net/npm/undoit@1.x.x/dist/esm/index.min.js)|\r\n\r\n### Node.js (commonjs)\r\n\r\n```bash\r\nnpm i undoit\r\n```\r\n\r\n### Browser (esmodule)\r\n\r\n```html\r\n\u003cscript type=\"module\"\u003e\r\n  import { Action, UndoRedo } from 'https://cdn.jsdelivr.net/npm/undoit@1.x.x/dist/esm/index.min.js'\r\n\u003c/script\u003e\r\n```\r\n\r\n## License\r\n\r\nMIT LICENSE\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizure1%2Fundoit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fizure1%2Fundoit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizure1%2Fundoit/lists"}