-
Notifications
You must be signed in to change notification settings - Fork 11
Usage
Offir Golan edited this page Jul 6, 2016
·
1 revision
Setup
import TimeMachine from 'ember-time-machine';
const content = Ember.Object.create({
firstName: 'Offir'
});
const timeMachine = TimeMachine.Object.create({ content });
Manipulate
timeMachine.get('firstName'); // --> 'Offir'
timeMachine.set('lastName', 'Golan');
Undo & Redo
timeMachine.get('lastName'); // --> 'Golan'
timeMachine.undo();
timeMachine.get('lastName'); // --> undefined
timeMachine.redo();
timeMachine.get('lastName'); // --> 'Golan'
Setup
import TimeMachine from 'ember-time-machine';
const timeMachine = TimeMachine.Array.create({ content: Ember.A([ 'offir' ]) });
Manipulate
timeMachine.get('firstObject'); // --> 'Offir'
timeMachine.pushObject('Golan');
Undo & Redo
timeMachine.objectAt(1); // --> 'Golan'
timeMachine.undo();
timeMachine.objectAt(1); // --> undefined
timeMachine.redo();
timeMachine.objectAt(1); // --> 'Golan'