{"id":13727242,"url":"https://github.com/uditalias/timeline","last_synced_at":"2025-05-03T06:30:49.369Z","repository":{"id":69249739,"uuid":"210597716","full_name":"uditalias/timeline","owner":"uditalias","description":"JavaScript Undo/Redo mechanism with simple API ✌️","archived":false,"fork":false,"pushed_at":"2024-08-28T09:02:47.000Z","size":17,"stargazers_count":33,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T05:28:32.611Z","etag":null,"topics":["history-management","npm-package","timeline","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/uditalias.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-09-24T12:29:21.000Z","updated_at":"2023-07-04T03:01:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5531642-f875-4952-9f4b-8e477494165e","html_url":"https://github.com/uditalias/timeline","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditalias%2Ftimeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditalias%2Ftimeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditalias%2Ftimeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uditalias%2Ftimeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uditalias","download_url":"https://codeload.github.com/uditalias/timeline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252154733,"owners_count":21702982,"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":["history-management","npm-package","timeline","undo-redo"],"created_at":"2024-08-03T01:03:45.685Z","updated_at":"2025-05-03T06:30:49.104Z","avatar_url":"https://github.com/uditalias.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003ch1 align=center\u003e\n🕰\u003c/br\u003e\nTimeline\n\u003c/h1\u003e\n\u003ch3 align=center\u003eJavaScript Undo/Redo mechanism with simple API \u003c 1KB\u003c/h3\u003e\n\u003cp align=center\u003e\n\u003ca href=\"https://travis-ci.org/uditalias/timeline\"\u003e\u003cimg src=\"https://travis-ci.org/uditalias/timeline.svg?branch=master\" alt=\"npm version\" height=\"18\"\u003e\u003c/a\u003e \u003ca href=\"https://badge.fury.io/js/%40udidu%2Ftimeline\"\u003e\u003cimg src=\"https://badge.fury.io/js/%40udidu%2Ftimeline.svg\" alt=\"npm version\" height=\"18\"\u003e\u003c/a\u003e \u003cimg src=\"https://img.shields.io/bundlephobia/minzip/@udidu/timeline\" alt=\"npm bundle size\" height=\"18\"\u003e\n\u003cbr/\u003e\n\u003cbr/\u003e\n\u003cimg alt=\"Langauge\" src=\"http://badge.langauge.io/uditalias/timeline?maxAge=600\"\u003e\n\u003c/p\u003e\n\n\u003ch4\u003eInstall\u003c/h4\u003e\n\n##### NPM\n\n```bash\nnpm i @udidu/timeline\n```\n\n##### YARN\n\n```bash\nyarn add @udidu/timeline\n```\n\n##### CDN\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@udidu/timeline@latest/umd/timeline.js\"\u003e\u003c/script\u003e\n```\n\nMinified\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@udidu/timeline@latest/umd/timeline.min.js\"\u003e\u003c/script\u003e\n```\n\n\u003ch4\u003eUsage\u003c/h4\u003e\n\n```javascript\nimport Timeline from \"@udidu/timeline\";\n\nconst timeline = new Timeline();\n\ntimeline.setPresent(1);\ntimeline.setPresent(2);\ntimeline.setPresent(3);\n\ntimeline.present; // 3\n\ntimeline.undo(); // 2\n\ntimeline.hasPast; // true\n\ntimeline.hasFuture; // true\n\ntimeline.setPresent(4);\n\ntimeline.hasFuture; // false\n\ntimeline.undo(); // 2\n\ntimeline.redo(); // 4\n\ntimeline.clear();\ntimeline.hasPast; // false\ntimeline.hasFuture; // false\n```\n\n\u003ch4\u003eOptions\u003c/h4\u003e\n\nAll options are optional\n\n```javascript\nconst timeline = new Timeline({\n  // The size of the past queue\n  // default: Infinity\n  size: 5,\n\n  // When calling `setPresent(preset)` the value is passed to this function.\n  // this is good for cases when we want to clone the object before saving it.\n  // default: echo function - returns the same value/reference\n  cloneFn: item =\u003e toJS(item),\n\n  // Initialize the present\n  // default: undefined\n  present: 2\n});\n```\n\nFor your convenience, I created this [**Fiddle**](https://jsfiddle.net/udidu/hcbkzvgj/), so you can take Timeline for a ride.\n\n---\n\n\u003ch4\u003eLicense\u003c/h4\u003e\n\nThe MIT License (MIT)\n\nCopyright (c) 2019 Udi Talias\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuditalias%2Ftimeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuditalias%2Ftimeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuditalias%2Ftimeline/lists"}