{"id":13805964,"url":"https://github.com/offirgolan/ember-time-machine","last_synced_at":"2025-04-13T21:37:00.164Z","repository":{"id":57224441,"uuid":"58434410","full_name":"offirgolan/ember-time-machine","owner":"offirgolan","description":"An object state management solution.","archived":false,"fork":false,"pushed_at":"2018-12-02T21:04:01.000Z","size":3228,"stargazers_count":108,"open_issues_count":5,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-18T08:11:03.468Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://offirgolan.github.io/ember-time-machine","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/offirgolan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-10T06:10:36.000Z","updated_at":"2024-04-24T01:35:53.000Z","dependencies_parsed_at":"2022-09-04T07:41:23.249Z","dependency_job_id":null,"html_url":"https://github.com/offirgolan/ember-time-machine","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offirgolan%2Fember-time-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offirgolan%2Fember-time-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offirgolan%2Fember-time-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offirgolan%2Fember-time-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/offirgolan","download_url":"https://codeload.github.com/offirgolan/ember-time-machine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788743,"owners_count":21161726,"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-04T01:01:06.661Z","updated_at":"2025-04-13T21:37:00.136Z","avatar_url":"https://github.com/offirgolan.png","language":"JavaScript","readme":"# Ember Time Machine\n\n[![Build Status](https://travis-ci.org/offirgolan/ember-time-machine.svg)](https://travis-ci.org/offirgolan/ember-time-machine)\n[![npm version](https://badge.fury.io/js/ember-time-machine.svg)](http://badge.fury.io/js/ember-time-machine)\n[![Test Coverage](https://codeclimate.com/github/offirgolan/ember-time-machine/badges/coverage.svg)](https://codeclimate.com/github/offirgolan/ember-time-machine/coverage)\n\nSay you are building a form, what’s the best way to handle the state of an underlying model? How do you revert unwanted changes? Do you use a buffer or take snapshots? What if your model has relationships, and those relationships have relationships?\n\nWhile Ember is a leading framework for building ambitious applications, it lacks the important ability to manage complex object state. Introducing Ember Time Machine, an addon that challenges this current issue and its limitations with a single command solution.\n\n## Features\n\n- Support for both Ember Objects and Arrays, as well as, Ember Data models\n- Tracks nested relational changes out of the box (including `hasMany` and `belongsTo` relationships)\n- Ability to revert array manipulations as well as object property changes\n- No buffer used so all changes are made on the actual model\n- Intelligently batches property changes when undoing and redoing\n\n## Installation\n\n```\nember install ember-time-machine\n```\n\n## Helpful Links\n\n- ### [Live Demo](http://offirgolan.github.io/ember-time-machine)\n\n- ### [Documentation](https://github.com/offirgolan/ember-time-machine/wiki)\n\n- ### [Changelog](CHANGELOG.md)\n\n## Looking for help?\nIf it is a bug [please open an issue on GitHub](http://github.com/offirgolan/ember-time-machine/issues).\n\n## Usage\n\n_**Note:** Ember Time Machine can be used with plain objects and arrays. This example is used to show the true potential of this addon_\n\n```js\n// models/user.js\nexport default DS.Model.extend({\n  firstName: attr('string'),\n  lastName: attr('string'),\n  username: attr('string'),\n  avatar: attr('string'),\n\n  settings: DS.belongsTo('setting'),\n  tasks: DS.hasMany('task')\n});\n```\n\n__Setup__\n\n```js\nimport TimeMachine from 'ember-time-machine';\n\nconst user = this.store.peekRecord('user', 1);\n\nconst timeMachine = TimeMachine.Object.create({ content: user });\n```\n\n__Manipulate__\n\n```javascript\n/** Basic Manipulations **/\ntimeMachine.set('username', 'offir.golan');\n\n/** Nested Array Manipulations **/\ntimeMachine.get('tasks').setEach('isCompleted', true);\ntimeMachine.get('tasks').pushObject(this.store.createRecord('task'));\n\n/** Nested Object Manipulations **/\ntimeMachine.set('settings.newOnTop', false);\n```\n\n__Time Travel__\n\n```js\ntimeMachine.undo(1, { on : [ 'username' ] }); // Undo the last username change\ntimeMachine.undo(1, { on : [ 'tasks' ] }); // Undo the last tasks change. This will undo the newly added task via pushObject\ntimeMachine.undo(2, { on: [ 'tasks.@each.isCompleted' ] }); // Undo the last 2 isCompleted changes on the tasks collection\ntimeMachine.undoAll({ on: [ 'settings.*' ] }); // Undo all changes on the settings object\ntimeMachine.undoAll(); // Undo all changes\n\ntimeMachine.redo(1, { on : [ 'username' ] }); // Redo the last undone change to username\ntimeMachine.redoAll(); // Redo all changes that have been undone\n```\n","funding_links":[],"categories":["Packages"],"sub_categories":["State management"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffirgolan%2Fember-time-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foffirgolan%2Fember-time-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffirgolan%2Fember-time-machine/lists"}